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

# Retrieve Order Custom Attribute

> Retrieves a [custom attribute](entity:CustomAttribute) associated with an order.

`square.retrieveOrderCustomAttribute` retrieves a [custom attribute](entity:CustomAttribute) associated with an order.

## Example

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

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

  square.retrieveOrderCustomAttribute({
    orderId: "order_id",
    customAttributeKey: "custom_attribute_key",
    version: 1,
    withDefinition: true,
  })
})
```

## Inputs

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

| Field                | Type              | Required | Default | Description                                                                                                                                                                                                                                                                                        |
| -------------------- | ----------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `orderId`            | `string`          | Yes      | —       | The ID of the target order.                                                                                                                                                                                                                                                                        |
| `customAttributeKey` | `string`          | Yes      | —       | The key of the custom attribute to retrieve. This key must match the key of an existing custom attribute definition.                                                                                                                                                                               |
| `version`            | `number \| null`  | No       | —       | To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include this optional field and specify the current version of the custom attribute.                                                                      |
| `withDefinition`     | `boolean \| null` | No       | `false` | Indicates whether to return the custom attribute definition in the `definition` field of each custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, information about the data type, or other definition details. The default value is `false`. |

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

## Output

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