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

> Creates a loyalty reward.

`square.createLoyaltyReward` creates a loyalty reward.

## Example

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

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

  square.createLoyaltyReward({
    reward: {
      loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
      rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
      orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
    },
    idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451",
  })
})
```

## Inputs

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

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

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

## Output

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