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

# Adjust Loyalty Points

> Adds points to or subtracts points from a buyer's account.

`square.adjustLoyaltyPoints` adds points to or subtracts points from a buyer's account.

## Example

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

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

  square.adjustLoyaltyPoints({
    accountId: "account_id",
    idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1",
    adjustPoints: {
      points: 10,
      reason: "Complimentary points",
    },
  })
})
```

## Inputs

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

| Field                  | Type                              | Required | Default | Description                                                                                                                                                                                                                                                                                                            |
| ---------------------- | --------------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountId`            | `string`                          | Yes      | —       | The ID of the target loyalty account.                                                                                                                                                                                                                                                                                  |
| `idempotencyKey`       | `string`                          | Yes      | —       | A unique string that identifies this `AdjustLoyaltyPoints` request. Keys can be any valid string, but must be unique for every request.                                                                                                                                                                                |
| `adjustPoints`         | `Square.LoyaltyEventAdjustPoints` | Yes      | —       | The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer. To subtract points, specify a negative integer.                                                                                                                                                            |
| `allowNegativeBalance` | `boolean \| null`                 | No       | `false` | Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting the specified number of points would result in a negative balance. The default value is `false`. |

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

## Output

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