---
title: "Create expense-transactions"
method: POST
path: "/companies/{companyId}/sync/expenses/data/expense-transactions"
tags: ["Expenses"]
---

# Create expense-transactions

`POST /companies/{companyId}/sync/expenses/data/expense-transactions`

Create an expense transaction

## Request body

- CreateExpenseRequest
  - `items` ExpenseTransaction[]
    - `id` string, uuid, required — Your unique identifier for the transaction.
    - `type` 'Payment' | 'Refund' | 'Reward' | 'Chargeback' | 'TransferIn' | 'TransferOut' | 'AdjustmentIn' | 'AdjustmentOut', required — The type of transaction.
    - `issueDate` Created, required — unresolved $ref
    - `currency` string, required — Currency the transaction was recorded in.
    - `currencyRate` number, 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 Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If 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. |
    - `contactRef` ContactRef
      - `id` string — Identifier of supplier or customer.
      - `contactType` 'Supplier' — The type of contact.
    - `merchantName` string — Name of the merchant where the purchase took place
    - `lines` ExpenseTransactionLine[] — Array of transaction lines.
      - `netAmount` number, required — Amount of the line, exclusive of tax.
      - `taxAmount` number, required — Amount of tax for the line.
      - `taxRateRef` RecordRef
        - `id` string — identifier of linked reference from mapping options.
      - `accountRef` RecordRef, required
        - `id` string — identifier of linked reference from mapping options.
      - `trackingRefs` RecordRef[]
        - `id` string — identifier of linked reference from mapping options.
    - `notes` string — Any private, company notes about the transaction.

## Response `200`

OK

- CreateExpenseResponse
  - `datasetId` string, uuid — Unique id of dataset created

## Other responses

- `400` — The request made is not valid.
- `401` — Your API request was not properly authorized.
- `402` — An account limit has been exceeded. The type of limit is described in the error property: - You have exceeded the 50-company limit that applies to a Free plan. Delete any companies you no longer need and retry the request. - The requested sync schedule is not allowed. You requested an hourly sync schedule but this functionality is not included in the Free plan. - Your Free account is older than 365 days and has expired. Contact support@codat.io.
- `403` — You are using an outdated API key or a key not associated with that resource.
- `404` — One or more of the resources you referenced could not be found. This might be because your company or data connection id is wrong, or was already deleted.
- `429` — Too many requests were made in a given amount of time. Wait a short period and then try again.
- `500` — There is a problem with our server. Please try again later.
- `503` — The Codat API is temporarily offline for maintenance. Please try again later.

---

[API](https://skmtc.net/codatio/apis/sync-for-expenses-v1.md) · [All operations](https://skmtc.net/codatio/apis/sync-for-expenses-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/codatio/sync-for-expenses-v1/revisions/83bf3779c510/schema)
