> ## 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 Loyalty Account

> Creates a loyalty account.

`square.createLoyaltyAccount` creates a loyalty account.

## Example

```ts automations/square-create-loyalty-account.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Create Square Loyalty Account", () => {
  onDashboardRun({ title: "Create Square Loyalty Account" })

  square.createLoyaltyAccount({
    loyaltyAccount: {
      programId: "d619f755-2d17-41f3-990d-c04ecedd64dd",
      mapping: {
        phoneNumber: "+14155551234",
      },
    },
    idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996",
  })
})
```

## Inputs

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

| Field            | Type                    | Required | Default | Description                                                                                                                              |
| ---------------- | ----------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `loyaltyAccount` | `Square.LoyaltyAccount` | Yes      | —       | The loyalty account to create.                                                                                                           |
| `idempotencyKey` | `string`                | Yes      | —       | A unique string that identifies this `CreateLoyaltyAccount` request. Keys can be any valid string, but must be unique for every request. |

Use the official [CreateLoyaltyAccount reference](https://developer.squareup.com/reference/square/loyalty-api/create-loyalty-account) for provider field semantics and limits.

## Output

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