Expenses

Create expense transaction

The Create expense endpoint creates an expense transaction in the accounting software for a given company's connection.

Expense transactions represent transactions made with a company debit or credit card.

Supported Integrations

IntegrationSupported
Dynamics 365 Business CentralYes
FreeAgentYes
QuickBooks DesktopYes
QuickBooks OnlineYes
Oracle NetSuiteYes
Sage IntacctYes
XeroYes
Zoho BooksYes
post/companies/{companyId}/sync/expenses/expense-transactions

Request body

idstring uuid required

Your unique identifier for the transaction.

type'Payment' | 'Refund' | 'Reward' | 'Chargeback' required

The type of transaction.

issueDate1 required— unresolved $ref
currencystring required

Currency the transaction was recorded in.

currencyRatenumber nullable

Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting software which do not provide an explicit currency rate, it is calculated as baseCurrency / foreignCurrency and will be returned to 9 decimal places.

Examples with base currency of GBP

Foreign CurrencyForeign AmountCurrency RateBase Currency Amount (GBP)
USD$200.781£15.62
EUR€200.885£17.70
RUB₽200.011£0.22

Examples with base currency of USD

Foreign CurrencyForeign AmountCurrency RateBase Currency Amount (USD)
GBP£201.277$25.54
EUR€201.134$22.68
RUB₽200.015$0.30

Integration-specific details

IntegrationScenarioSystem behavior
QuickBooks OnlineTransaction currency differs from base currencyIf currency rate value is left null, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body.
referencestring nullable

User-friendly reference for the expense transaction.

merchantNamestring

Name of the merchant where the purchase took place

notesstring

Any private, company notes about the transaction.

postAsDraftboolean nullable

This optional property, when set to true, posts the transaction to a drafted state. Note that postAsDraft is only supported in Microsoft Dynamics 365 Business Central.

Example request

[
  {
    "id": "a44135b0-6882-489a-83fe-a0c57a4afb19",
    "type": "Payment",
    "issueDate": "2024-05-21T00:00:00+00:00",
    "currency": "GBP",
    "currencyRate": 1,
    "contactRef": {
      "id": "430",
      "type": "Supplier"
    },
    "bankAccountRef": {
      "id": "97"
    },
    "merchantName": "Amazon UK",
    "notes": "amazon purchase",
    "lines": [
      {
        "netAmount": 100,
        "taxAmount": 20,
        "taxRateRef": {
          "id": "23_Bills"
        },
        "accountRef": {
          "id": "35"
        },
        "trackingRefs": [
          {
            "id": "DEPARTMENT_3"
          },
          {
            "dataType": "trackingCategories"
          }
        ],
        "invoiceTo": {
          "id": "504",
          "type": "customer"
        }
      }
    ]
  }
]

Response

OK

syncIdstring uuid

Unique id of sync created

Example response

{
  "syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"
}