> ## 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 Order Custom Attribute Definition

> Updates an order-related custom attribute definition for a Square seller account.

`square.updateOrderCustomAttributeDefinition` updates an order-related custom attribute definition for a Square seller account.

## Example

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

export default automation(
  "Update Square Order Custom Attribute Definition",
  () => {
    onDashboardRun({ title: "Update Square Order Custom Attribute Definition" })

    square.updateOrderCustomAttributeDefinition({
      key: "key",
      customAttributeDefinition: {
        key: "cover-count",
        visibility: "VISIBILITY_READ_ONLY",
        version: 1,
      },
      idempotencyKey: "IDEMPOTENCY_KEY",
    })
  },
)
```

## Inputs

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

| Field                       | Type                               | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------- | ---------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `key`                       | `string`                           | Yes      | —       | The key of the custom attribute definition to update.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `customAttributeDefinition` | `Square.CustomAttributeDefinition` | Yes      | —       | The custom attribute definition that contains the fields to update. This endpoint supports sparse updates, so only new or changed fields need to be included in the request. For more information, see [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields). To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition. |
| `idempotencyKey`            | `string \| null`                   | No       | —       | A unique identifier for this request, used to ensure idempotency. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).                                                                                                                                                                                                                                                                                                                                                                                                                       |

Use the official [UpdateOrderCustomAttributeDefinition reference](https://developer.squareup.com/reference/square/order-custom-attributes-api/update-order-custom-attribute-definition) for provider field semantics and limits.

## Output

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