Skip to main content

Create and update expenses

Record and update expense transactions that represent your customers' spend

Overview

An expense is a transaction that represents the purchase made by your customer and the context behind that purchase. It usually includes the following details:

  • Transaction type, e.g. whether it's a payment or a refund
  • General ledger account the transaction should be reconciled to
  • Associated tax rates
  • Applicable tracking categories

With Sync for Expenses, you need to create the expense or transfer transactions first and push that dataset to Codat. We will describe options available to you on this page.

Then, you need to sync expenses to reflect these in your customer's accounting platform. Finally, once these transactions have been synced, you can upload attachments to associate receipts with the transaction.

This process is summarized on the diagram below.

Create expenses

To create a new expense transaction in Codat, use the Create expense transaction endpoint.

In the request, make sure that the transaction's id is unique as it serves as an idempotence key. Codat validates the id to ensure that it's unique to a company, preventing the creation of duplicate transactions in your SMB's accounting software.

Expense transaction request body
{
"items": [
{
"id": "08ca1f02-0374-11ed-b939-0242ac120002",
"type": "Payment",
"issueDate": "2023-12-13T00:00:00+00:00",
"currency": "GBP",
"currencyRate": 1.26,
"contactRef":{
"id":"an-id-to-a-suppliers-record",
"type": "Supplier"
},
"postAsDraft": false,
"merchantName": "Amazon UK",
"lines": [
{
"netAmount": 110.42,
"taxAmount": 14.43,
"taxRateRef": {
"id": "an-id-to-a-taxRates-record"
},
"accountRef": {
"id": "id-of-the-expense-nominal-account"
},
"trackingRefs": [
{
"id": "an-id-to-a-trackingCategories-record",
"dataType": "trackingCategories"
}
],
"invoiceTo": {
"id": "an-id-to-a-customers-record",
"dataType": "customers"
}
}
],
"notes": "Amazon UK | Online Purchase | Order 123XX45"
}
]
}

Next, you need to follow up with an expense sync to reflect this item of spend in the customer's accounting platform. We cover this in detail in Sync expenses.

Draft transactions

Some accounting platforms allow expense transactions to be created in a draft state instead of posting directly to the ledger. This means the user can review the expense in the accounting platform before finalizing and posting it prior to reconciliation.

To create an expense as a draft, set the postAsDraft property on the transaction to true. For platforms without this feature, the postAsDraft property should be ignored or set to false.

Compatible integrations

This functionality is currently only available for Microsoft Dynamics.

Billable expenses

Your customer may want to mark an expense as billable so that they can easily identify and allocate costs to specific customers or projects. This simplifies the process of invoicing clients for reimbursable expenses.

To mark an expense as billable, set the invoiceTo property to customer. The expense will then reference the customer in the line item.

Compatible integrations

This functionality is currently only available for QuickBooks Online and QuickBooks Desktop.

Multicurrency expense transactions

Sync for Expenses validates each expense transaction involving foreign currency. We ensure that the combination of participating currencies will be accepted by the target accounting platform as a valid expense. You can read more about expenses in foreign currency and platform support for different transaction types.

Default tax rates

If you need to remove an associated tax rate from an expense, use one of the following default values that have no impact on the expense:

PlatformDefault tax rate
QuickBooks OnlineNON
XeroNONE
Oracle NetSuite-7
Dynamics 365Set up and apply a 0% tax rate
QuickBooks DesktopNull

Transaction types

Sync for Expenses maps and processes expense transactions based on the following transaction types:

Transaction typeDescription
paymentRepresents any spend that takes place on the account and interest on credit purchases.
refundRepresents any refunds and returns on an original transaction.
rewardRepresents reward redemptions, such as cashback.
chargebackSimilarly to a refund, represents a return of a transaction or a payment sum which may have been disputed.
transferInTransaction type to be deprecated in June 2024.
A transfer that decreases the balance of the credit card account or increases the balance of a bank account.
Represents a top-up of debit card account, a pay-down of a credit card account, or a balance transfer to another credit card.
transferOutTransaction type to be deprecated in June 2024.
A transfer that increases the balance of the credit account or decreases the balance of a bank account.
Represents cash withdrawals or a balance transfer to another credit card.
adjustmentInAn adjustment that decreases the balance of the credit account or increases the balance of a bank account.
Represents write-offs and transaction adjustments, such as foreign exchange adjustments.
adjustmentOutAn adjustment that increases the balance of the credit account or decreases the balance of a bank account.
Represents write-offs and transaction adjustments, such as foreign exchange adjustments.

Update expenses

Compatible integrations

Check our API reference for an up-to-date list of integrations that support this functionality.

In some cases, your customer may want to update an expense transaction that was previously synced to their accounting platform. Use our Update expense transactions endpoint to edit the following parameters and reflect the change in the SMB's accounting software:

  • Net expense amount
  • Tax amount of the spend
  • Tax rate reference associated with the spend
  • Expense bank account reference
  • Tracking category objects
  • Description and notes
Update an expense transaction
PUT  https://api.codat.io/companies/{companyId}/sync/expenses/expense-transactions

  • Sync the expenses to reflect the spend in the accounting platform and monitor the progress of the synchronization.

Was this page useful?
❤️
👍
🤔
👎
😭