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

> Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.

`square.updateMerchantCustomAttributeDefinition` updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account.

## Example

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

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

    square.updateMerchantCustomAttributeDefinition({
      key: "key",
      customAttributeDefinition: {
        description: "Update the description as desired.",
        visibility: "VISIBILITY_READ_ONLY",
      },
    })
  },
)
```

## Inputs

Every input accepts a compatible signal. It requires `MERCHANT_PROFILE_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. Only the following fields can be updated: - `name` - `description` - `visibility` - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed selections are supported. For more information, see [Update a merchant custom attribute definition](https://developer.squareup.com/docs/merchant-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition). The version field must match the current version of the custom attribute definition to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD\_REQUEST error. |
| `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 [UpdateMerchantCustomAttributeDefinition reference](https://developer.squareup.com/reference/square/merchant-custom-attributes-api/update-merchant-custom-attribute-definition) for provider field semantics and limits.

## Output

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