> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Update Invoice

> Updates an invoice.

`square.updateInvoice` updates an invoice.

## Example

```ts automations/square-update-invoice.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Update Square Invoice", () => {
  onDashboardRun({ title: "Update Square Invoice" })

  square.updateInvoice({
    invoiceId: "invoice_id",
    invoice: {
      version: 1,
      paymentRequests: [
        {
          uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355",
          tippingEnabled: false,
        },
      ],
    },
    idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be",
  })
})
```

## Inputs

Every input accepts a compatible signal. It requires `INVOICES_WRITE` and `ORDERS_WRITE`.

| Field            | Type               | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                         |
| ---------------- | ------------------ | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `invoiceId`      | `string`           | Yes      | —       | The ID of the invoice to update.                                                                                                                                                                                                                                                                                                                                                    |
| `invoice`        | `Square.Invoice`   | Yes      | —       | The invoice fields to add, change, or clear. Fields can be cleared using null values or the `remove` field (for individual payment requests or reminders). The current invoice `version` is also required. For more information, including requirements, limitations, and more examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices). |
| `idempotencyKey` | `string \| null`   | No       | —       | A unique string that identifies the `UpdateInvoice` request. If you do not provide `idempotency_key` (or provide an empty string as the value), the endpoint treats each request as independent. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).                                                         |
| `fieldsToClear`  | `string[] \| null` | No       | —       | The list of fields to clear. Although this field is currently supported, we recommend using null values or the `remove` field when possible. For examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices).                                                                                                                               |

Use the official [UpdateInvoice reference](https://developer.squareup.com/reference/square/invoices-api/update-invoice) for provider field semantics and limits.

## Output

Returns the official `Square.UpdateInvoiceResponse` response as a codec-safe object. Square integer money amounts remain `bigint` values.
