> ## 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.

# Upsert Booking Custom Attribute

> Upserts a bookings custom attribute.

`square.upsertBookingCustomAttribute` upserts a bookings custom attribute.

## Example

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

export default automation("Upsert Square Booking Custom Attribute", () => {
  onDashboardRun({ title: "Upsert Square Booking Custom Attribute" })

  square.upsertBookingCustomAttribute({
    bookingId: "booking_id",
    key: "key",
    customAttribute: {},
  })
})
```

## Inputs

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

| Field             | Type                     | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------- | ------------------------ | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bookingId`       | `string`                 | Yes      | —       | The ID of the target booking.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `key`             | `string`                 | Yes      | —       | The key of the custom attribute to create or update. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.                                                                                                                                                                                                                                                                                                                                |
| `customAttribute` | `Square.CustomAttribute` | Yes      | —       | The custom attribute to create or update, with the following fields: - `value`. This value must conform to the `schema` specified by the definition. For more information, see [Value data types](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attributes#value-data-types). - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control for an update operation, include this optional field and specify the current version of the custom attribute. |
| `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 [UpsertBookingCustomAttribute reference](https://developer.squareup.com/reference/square/booking-custom-attributes-api/upsert-booking-custom-attribute) for provider field semantics and limits.

## Output

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