This is a staging build of the docs
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 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.

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.

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"
}
]
}

Draft transactions

Compatible integrations

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

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

In the request body, use the postAsDraft flag to define whether the expense should be posted in its draft or final state. When set to true, the expense is posted as a draft.

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

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.
transferInA 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.
transferOutA 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?
❤️
👍
🤔
👎
😭