> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ReallocateBenefit

# Package: benefitPrograms

# Namespace: PoolService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/reallocate-benefit.md

## Permission Scopes:
Manage benefit programs: SCOPE.BENEFIT_PROGRAMS.MANAGE

## Introduction

Reallocates a redeemed benefit to a new target date.

Reallocation doesn't change the pool's balance. The item, item count, and benefit key of the original redemption are kept, and only the target date changes.
The reallocation is recorded as a new transaction that supersedes the specified transaction.

Specify the ID of the latest transaction for the redemption. This is the transaction ID returned by [Redeem Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/redeem-benefit.md) or, if the redemption was already reallocated, by the last call to Reallocate Benefit for this redemption.
If you specify an older transaction, the method fails with a `NOT_LATEST_TRANSACTION` error whose details include the latest transaction ID, so you can retry with it.

Before the benefit is reallocated, the pool's status, the pool's policies for the new target date, and the item's availability in the pool are checked. Reallocation is allowed for `ACTIVE` and `PAUSED` pools. The pool's balance isn't checked.

You can reallocate the same redemption multiple times. To return the redeemed credits to the pool instead, call [Cancel Redemption](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/cancel-redemption.md).

---

## REST API

### Schema

```
 Method: reallocateBenefit
 Description: Reallocates a redeemed benefit to a new target date.  Reallocation doesn't change the pool's balance. The item, item count, and benefit key of the original redemption are kept, and only the target date changes. The reallocation is recorded as a new transaction that supersedes the specified transaction.  Specify the GUID of the latest transaction for the redemption. This is the transaction GUID returned by [Redeem Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/redeem-benefit.md) or, if the redemption was already reallocated, by the last call to Reallocate Benefit for this redemption. If you specify an older transaction, the method fails with a `NOT_LATEST_TRANSACTION` error whose details include the latest transaction GUID, so you can retry with it.  Before the benefit is reallocated, the pool's status, the pool's policies for the new target date, and the item's availability in the pool are checked. Reallocation is allowed for `ACTIVE` and `PAUSED` pools. The pool's balance isn't checked.  You can reallocate the same redemption multiple times. To return the redeemed credits to the pool instead, call [Cancel Redemption](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/cancel-redemption.md).
 URL: https://www.wixapis.com/benefit-programs/v1/benefits/reallocate
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  transactionId, targetDate, idempotencyKey, namespace
 Method parameters: 
   param name: beneficiary | type: IdentificationData   | required: true 
    - ONE-OF: - required: true
     - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site.  | validation: format GUID
     - name: memberId | type: string | description: GUID of a site member.  | validation: format GUID
     - name: wixUserId | type: string | description: GUID of a Wix user.  | validation: format GUID
   param name: idempotencyKey | type: idempotencyKey | description: Unique identifier, generated by the client. Used to recognize repeated attempts to make the same request. | required: true | validation: maxLength 200
   param name: namespace | type: namespace | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. | required: true | validation: minLength 1, maxLength 20
   param name: targetDate | type: targetDate | description: New date the item is provided to the beneficiary. | required: true | validation: format date-time
   param name: transactionId | type: transactionId | description: GUID of the latest transaction for the redemption to reallocate. This is the transaction GUID returned by Redeem Benefit or, if the redemption was already reallocated, by the last call to Reallocate Benefit. | required: true | validation: format GUID
 Return type: ReallocateBenefitResponse
  - name: transactionId | type: string | description: GUID of the reallocation transaction. Specify this GUID the next time you reallocate or cancel this redemption.  | validation: format GUID

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: POOL_NOT_FOUND | Description: Couldn't find the pool.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: TRANSACTION_NOT_FOUND | Description: Couldn't find the transaction. Also returned when `beneficiary` doesn't match the beneficiary of the original redemption.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ALREADY_EXECUTED | Description: Benefit was already reallocated with the specified `idempotencyKey`. This is likely a duplicate call.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CHAIN_OPERATION_IN_PROGRESS | Description: Another operation on this redemption is still in progress. Retry later with the same `idempotencyKey`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: POLICY_EXPRESSION_EVALUATED_TO_FALSE | Description: The pool's policies don't allow the benefit on the new `targetDate`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ITEM_NOT_AVAILABLE_IN_POOL | Description: The redeemed item is no longer available in the pool.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: POOL_NOT_REALLOCATABLE | Description: The pool's status doesn't allow reallocation. Reallocation is allowed for `ACTIVE` and `PAUSED` pools.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TRANSACTION_NOT_REALLOCATABLE | Description: The specified transaction isn't a redemption or a reallocation, so it can't be reallocated.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: REDEMPTION_ALREADY_CANCELED | Description: Redemption was already canceled.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: NOT_LATEST_TRANSACTION | Description: The specified transaction isn't the latest transaction for the redemption. Retry with the `latestTransactionId` returned in the error details.


```

### Examples

### Reallocate a redeemed benefit to a new date
Moves a redemption to a new target date without changing the pool's balance.

```curl
curl -X POST \
'https://www.wixapis.com/benefit-programs/v1/benefits/reallocate' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "transactionId": "15080f5e-f2cc-41a6-8ec0-30e15f44f45b",
  "targetDate": "2026-12-18T09:00:00.000Z",
  "idempotencyKey": "8d2c7e41-5a9b-4f36-b0e8-71c4a2d95f13",
  "beneficiary": {
    "memberId": "00000000-0000-0000-0000-000000000000"
  },
  "namespace": "benefit_programs_app"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.benefitPrograms.pools.reallocateBenefit(transactionId, options)
 Description: Reallocates a redeemed benefit to a new target date.  Reallocation doesn't change the pool's balance. The item, item count, and benefit key of the original redemption are kept, and only the target date changes. The reallocation is recorded as a new transaction that supersedes the specified transaction.  Specify the GUID of the latest transaction for the redemption. This is the transaction GUID returned by [Redeem Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/redeem-benefit.md) or, if the redemption was already reallocated, by the last call to Reallocate Benefit for this redemption. If you specify an older transaction, the method fails with a `NOT_LATEST_TRANSACTION` error whose details include the latest transaction GUID, so you can retry with it.  Before the benefit is reallocated, the pool's status, the pool's policies for the new target date, and the item's availability in the pool are checked. Reallocation is allowed for `ACTIVE` and `PAUSED` pools. The pool's balance isn't checked.  You can reallocate the same redemption multiple times. To return the redeemed credits to the pool instead, call [Cancel Redemption](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/cancel-redemption.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  transactionId, options.targetDate, optionsempotencyKey, options.beneficiary, options.namespace, options
 Method parameters: 
   param name: transactionId | type: string | description: GUID of the latest transaction for the redemption to reallocate. This is the transaction GUID returned by Redeem Benefit or, if the redemption was already reallocated, by the last call to Reallocate Benefit. | required: true | validation: format GUID
   param name: options | type: ReallocateBenefitOptions  none | required: true 
        - name: targetDate | type: Date | description: New date the item is provided to the beneficiary. | required: true 
        - name: idempotencyKey | type: string | description: Unique identifier, generated by the client. Used to recognize repeated attempts to make the same request. | required: true | validation: maxLength 200
        - name: beneficiary | type: IdentificationData | description: Beneficiary of the pool that contains the benefit to reallocate. Must match the beneficiary of the original redemption. | required: true 
           - ONE-OF: 
              - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site.  | validation: format GUID
              - name: memberId | type: string | description: GUID of a site member.  | validation: format GUID
              - name: wixUserId | type: string | description: GUID of a Wix user.  | validation: format GUID
        - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. | required: true | validation: minLength 1, maxLength 20
 Return type: PROMISE<ReallocateBenefitResponse>
  - name: transactionId | type: string | description: GUID of the reallocation transaction. Specify this GUID the next time you reallocate or cancel this redemption.  | validation: format GUID

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: POOL_NOT_FOUND | Description: Couldn't find the pool.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: TRANSACTION_NOT_FOUND | Description: Couldn't find the transaction. Also returned when `beneficiary` doesn't match the beneficiary of the original redemption.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ALREADY_EXECUTED | Description: Benefit was already reallocated with the specified `idempotencyKey`. This is likely a duplicate call.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CHAIN_OPERATION_IN_PROGRESS | Description: Another operation on this redemption is still in progress. Retry later with the same `idempotencyKey`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: POLICY_EXPRESSION_EVALUATED_TO_FALSE | Description: The pool's policies don't allow the benefit on the new `targetDate`.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ITEM_NOT_AVAILABLE_IN_POOL | Description: The redeemed item is no longer available in the pool.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: POOL_NOT_REALLOCATABLE | Description: The pool's status doesn't allow reallocation. Reallocation is allowed for `ACTIVE` and `PAUSED` pools.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: TRANSACTION_NOT_REALLOCATABLE | Description: The specified transaction isn't a redemption or a reallocation, so it can't be reallocated.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: REDEMPTION_ALREADY_CANCELED | Description: Redemption was already canceled.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: NOT_LATEST_TRANSACTION | Description: The specified transaction isn't the latest transaction for the redemption. Retry with the `latestTransactionId` returned in the error details.


```

### Examples

### Reallocate a redeemed benefit to a new date
Moves a redemption to a new target date without changing the pool's balance.

```javascript
import { pools } from "@wix/benefit-programs";

async function reallocateBenefit() {
  const response = await pools.reallocateBenefit(
    "15080f5e-f2cc-41a6-8ec0-30e15f44f45b",
    {
      targetDate: new Date("2026-12-18T09:00:00.000Z"),
      idempotencyKey: "8d2c7e41-5a9b-4f36-b0e8-71c4a2d95f13",
      beneficiary: {
        memberId: "00000000-0000-0000-0000-000000000000",
      },
      namespace: "benefit_programs_app",
    },
  );
}

/* Promise resolves to:
 * {
 *   "transactionId": "e4b91c27-6f3d-4a58-9c02-b7d5e18a3f60"
 * }
 */

```

### reallocateBenefit (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { pools } from '@wix/benefit-programs';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { pools },
  // Include the auth strategy and host as relevant
});


async function reallocateBenefit(transactionId,options) {
  const response = await myWixClient.pools.reallocateBenefit(transactionId,options);
};
```

---