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

# Create Order Custom Attribute Definition

> Creates an order-related custom attribute definition.

`square.createOrderCustomAttributeDefinition` creates an order-related custom attribute definition.

## Example

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

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

    square.createOrderCustomAttributeDefinition({
      customAttributeDefinition: {
        key: "cover-count",
        schema: {
          $ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number",
        },
        name: "Cover count",
        description: "The number of people seated at a table",
        visibility: "VISIBILITY_READ_WRITE_VALUES",
      },
      idempotencyKey: "IDEMPOTENCY_KEY",
    })
  },
)
```

## Inputs

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

| Field                       | Type                               | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------- | ---------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `customAttributeDefinition` | `Square.CustomAttributeDefinition` | Yes      | —       | The custom attribute definition to create. Note the following: - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema definition hosted on the Square CDN. For more information, including supported values and constraints, see [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema). - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`. |
| `idempotencyKey`            | `string`                           | 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 [CreateOrderCustomAttributeDefinition reference](https://developer.squareup.com/reference/square/order-custom-attributes-api/create-order-custom-attribute-definition) for provider field semantics and limits.

## Output

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