---
title: "Update invoice"
method: PUT
path: "/companies/{companyId}/connections/{connectionId}/push/invoices/{invoiceId}"
tags: ["Invoices"]
---

# Update invoice

`PUT /companies/{companyId}/connections/{connectionId}/push/invoices/{invoiceId}`

The *Update invoice* endpoint updates an existing [invoice](https://docs.codat.io/accounting-api#/schemas/Invoice) for a given company's connection.

[Invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer.

**Integration-specific behavior**

Required data may vary by integration. To see what data to post, first call [Get create/update invoice model](https://docs.codat.io/accounting-api#/operations/get-create-update-invoices-model).

## Path parameters

- `invoiceId` string, required

## Query parameters

- `timeoutInMinutes` integer
- `forceUpdate` boolean

## Request body

- Invoice, nullable — > **Invoices or bills?** > > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. > > See [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) for the accounts payable equivalent of bills. ## Overview An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/accounting-api#/schemas/Customer). In Codat, an invoice contains details of: - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. - Who the invoice has been raised to; the _customer_. - The breakdown of what the invoice is for; the _line items_. - Any [payments](https://docs.codat.io/accounting-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. > **Invoice PDF downloads** > > You can <a className="external" href="https://docs.codat.io/accounting-api#/operations/get-invoice-pdf" target="_blank">download a PDF version</a> of an invoice for supported integrations. > > The filename will be invoice-{number}.pdf. > **Referencing an invoice in Sage 50 and ClearBooks** > > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same.
  - `id` string — Identifier for the invoice, unique to the company in the accounting software.
  - `invoiceNumber` string, nullable — Friendly reference for the invoice. If available, this appears in the file name of invoice attachments.
  - `customerRef` AccountingCustomerRef — unresolved $ref
  - `salesOrderRefs` SalesOrderRef[], nullable — List of references to related Sales orders. — unresolved $ref
  - `issueDate` string, required — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `dueDate` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `paidOnDate` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `currency` Currency — unresolved $ref
  - `currencyRate` CurrencyRate — unresolved $ref
  - `lineItems` InvoiceLineItem[], nullable — An array of line items. — unresolved $ref
  - `paymentAllocations` Items[], nullable — An array of payment allocations. — unresolved $ref
  - `withholdingTax` Items[], nullable — unresolved $ref
  - `totalDiscount` number, nullable — Numerical value of discounts applied to the invoice.
  - `subTotal` number, nullable — Total amount of the invoice excluding any taxes.
  - `additionalTaxAmount` number — Additional tax amount applied to invoice.
  - `additionalTaxPercentage` number — Percentage rate of any additional tax applied to the invoice.
  - `totalTaxAmount` number, required — Amount of tax on the invoice.
  - `totalAmount` number, required — Amount of the invoice, inclusive of tax.
  - `amountDue` number, required — Amount outstanding on the invoice.
  - `discountPercentage` number, nullable — Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`.
  - `status` InvoiceStatus, required — unresolved $ref
  - `note` string, nullable — Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer.
  - `metadata` Metadata
    - `isDeleted` boolean, nullable — Indicates whether the record has been deleted in the third-party system this record originated from.
  - `supplementalData` SupplementalData — Supplemental data is additional data you can include in our standard data types. It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data.
    - `content` object, nullable
  - `modifiedDate` string — The date when the record was last fetched from the accounting software, commerce software, or open banking provider and updated in Codat’s data cache. Use it to identify and retrieve records that have changed since your last fetch. For example, filtering `modifiedDate` to today will provide new records updated in Codat today. This date is populated for all data types except for attachments, balance sheets, company information, and profit & loss reports ([read more](https://docs.codat.io/using-the-api/modified-dates#modified-date)). In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>.
  - `sourceModifiedDate` string — The date when a record was last modified in the accounting software, usually by the business or a business process. For example, when payments are made against an invoice. It is not populated ([read more](https://docs.codat.io/using-the-api/modified-dates#source-modified-date)) when: - Pulling attachments - The accounting software does not provide modification dates for a data type - A record has been deleted from the source platform and Codat doesn't have a record of when the deletion occurred - A record has been voided. For certain platforms that soft delete records, `isDeleted` metadata is used to identify void records In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>.

## Response `200`

Success

- UpdateInvoiceResponse
  - `data` object, nullable — > **Invoices or bills?** > > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. > > See [Bills](https://docs.codat.io/accounting-api#/schemas/Bill) for the accounts payable equivalent of bills. ## Overview An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/accounting-api#/schemas/Customer). In Codat, an invoice contains details of: - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. - Who the invoice has been raised to; the _customer_. - The breakdown of what the invoice is for; the _line items_. - Any [payments](https://docs.codat.io/accounting-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. > **Invoice PDF downloads** > > You can <a className="external" href="https://docs.codat.io/accounting-api#/operations/get-invoice-pdf" target="_blank">download a PDF version</a> of an invoice for supported integrations. > > The filename will be invoice-{number}.pdf. > **Referencing an invoice in Sage 50 and ClearBooks** > > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same.
    - `id` string — Identifier for the invoice, unique to the company in the accounting software.
    - `invoiceNumber` string, nullable — Friendly reference for the invoice. If available, this appears in the file name of invoice attachments.
    - `customerRef` AccountingCustomerRef — unresolved $ref
    - `salesOrderRefs` SalesOrderRef[], nullable — List of references to related Sales orders. — unresolved $ref
    - `issueDate` string, required — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
    - `dueDate` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
    - `paidOnDate` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
    - `currency` Currency — unresolved $ref
    - `currencyRate` CurrencyRate — unresolved $ref
    - `lineItems` InvoiceLineItem[], nullable — An array of line items. — unresolved $ref
    - `paymentAllocations` Items[], nullable — An array of payment allocations. — unresolved $ref
    - `withholdingTax` Items[], nullable — unresolved $ref
    - `totalDiscount` number, nullable — Numerical value of discounts applied to the invoice.
    - `subTotal` number, nullable — Total amount of the invoice excluding any taxes.
    - `additionalTaxAmount` number — Additional tax amount applied to invoice.
    - `additionalTaxPercentage` number — Percentage rate of any additional tax applied to the invoice.
    - `totalTaxAmount` number, required — Amount of tax on the invoice.
    - `totalAmount` number, required — Amount of the invoice, inclusive of tax.
    - `amountDue` number, required — Amount outstanding on the invoice.
    - `discountPercentage` number, nullable — Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`.
    - `status` InvoiceStatus, required — unresolved $ref
    - `note` string, nullable — Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer.
    - `metadata` Metadata
      - `isDeleted` boolean, nullable — Indicates whether the record has been deleted in the third-party system this record originated from.
    - `supplementalData` SupplementalData — Supplemental data is additional data you can include in our standard data types. It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data.
      - `content` object, nullable
    - `modifiedDate` string — The date when the record was last fetched from the accounting software, commerce software, or open banking provider and updated in Codat’s data cache. Use it to identify and retrieve records that have changed since your last fetch. For example, filtering `modifiedDate` to today will provide new records updated in Codat today. This date is populated for all data types except for attachments, balance sheets, company information, and profit & loss reports ([read more](https://docs.codat.io/using-the-api/modified-dates#modified-date)). In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>.
    - `sourceModifiedDate` string — The date when a record was last modified in the accounting software, usually by the business or a business process. For example, when payments are made against an invoice. It is not populated ([read more](https://docs.codat.io/using-the-api/modified-dates#source-modified-date)) when: - Pulling attachments - The accounting software does not provide modification dates for a data type - A record has been deleted from the source platform and Codat doesn't have a record of when the deletion occurred - A record has been voided. For certain platforms that soft delete records, `isDeleted` metadata is used to identify void records In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>.
  - `changes` PushOperationChange[], nullable — Contains a single entry that communicates which record has changed and the manner in which it changed. — unresolved $ref
  - `dataType` 'accountTransactions' | 'balanceSheet' | 'bankAccounts' | 'bankTransactions' | 'billCreditNotes' | 'billPayments' | 'bills' | 'cashFlowStatement' | 'chartOfAccounts' | 'company' | 'creditNotes' | 'customers' | 'directCosts' | 'directIncomes' | 'invoices' | 'itemReceipts' | 'items' | 'journalEntries' | 'journals' | 'paymentMethods' | 'payments' | 'profitAndLoss' | 'purchaseOrders' | 'salesOrders' | 'suppliers' | 'taxRates' | 'trackingCategories' | 'transfers' | 'banking-accountBalances' | 'banking-accounts' | 'banking-transactionCategories' | 'banking-transactions' | 'commerce-companyInfo' | 'commerce-customers' | 'commerce-disputes' | 'commerce-locations' | 'commerce-orders' | 'commerce-paymentMethods' | 'commerce-payments' | 'commerce-productCategories' | 'commerce-products' | 'commerce-taxComponents' | 'commerce-transactions' — Available data types
  - `companyId` Schema, required — unresolved $ref
  - `pushOperationKey` string, uuid, required — A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.
  - `dataConnectionKey` Schema, required — unresolved $ref
  - `requestedOnUtc` string, required — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `completedOnUtc` string — In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example: ``` 2020-10-08T22:40:50Z 2021-01-01T00:00:00 ``` When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - Unqualified local time: `2021-11-15T01:00:00` - UTC time offsets: `2021-11-15T01:00:00-05:00` > Time zones > > Not all dates from Codat will contain information about time zones. > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
  - `timeoutInMinutes` integer, nullable — Number of minutes the push operation must complete within before it times out.
  - `timeoutInSeconds` integer, nullable — Number of seconds the push operation must complete within before it times out.
  - `status` PushOperationStatus, required — unresolved $ref
  - `errorMessage` string, nullable — A message about the error.
  - `validation` Validation — unresolved $ref
  - `statusCode` integer, required — Push status code.

## 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/accounting-api.md) · [All operations](https://skmtc.net/codatio/apis/accounting-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/codatio/accounting-api/revisions/21d41189c461/schema)
