# Triggering a rebalancing

## Prerequisites

- **Authentication scopes** — `portfolios:admin`
For more information, refer to [Authentication scopes](/products/tol/concepts/api_concepts/authentication/authentication_oauth#list-of-authentication-scopes).
- **Webhook handler ready** — Set up a webhook endpoint to listen for rebalancing events.
  - Subscribe to [`REBALANCING_EXECUTION_ORDER.*`, `PORTFOLIO_ORDER.*`, `ORDER.*`, and `EXECUTION.*`](/products/tol/guides/portfolios/rebalancing/rebalancing_webhooks) events.
For more information, refer to [Implementing webhooks](/products/tol/getting_started/implementing_webhooks).


**Recommended: Monitor rebalancing with webhooks**

Before you trigger a rebalancing, subscribe to webhook events to track the execution of rebalancing orders in real time. You receive notifications as orders transition through their lifecycle (NEW → PROCESSING → FILLED) and execution events as individual trades settle.

For more information, refer to [Rebalancing webhook events](/products/tol/guides/portfolios/rebalancing/rebalancing_webhooks).

To complete the reallocation of a portfolio, you must trigger a rebalancing for the account.

**POST** [`/portfolios/rebalancings/executions`](/api/portfolios-rebalancing/trigger_portfolio_rebalancing)

## Triggering at global portfolio allocation level

Request
```json
{
  "allocations": [
    "eafa39e3-7837-476f-8af1-49fa604e3f49"
  ]
}
```

In this example, the one-off rebalancing is triggered at the 'global' portfolio allocation level, i.e., it applies to all accounts that have this allocation in their portfolio configuration.

## Triggering at accounts level

You can also trigger the one-off portfolio rebalancing at a more granular level of individual accounts by selecting single or multiple accounts:

Request
```json
{
  "accounts": [
    "43801b85-bbcf-41c7-8389-b018082a5ec5",
    "20151679-c159-4f16-b8a2-267b3d968c6f"
  ]
}
```

In both cases, the response contains the `id` of the rebalancing execution. You can use this ID to list all portfolio orders created as a result of the trigger at all times.

The portfolio rebalancing execution request triggers a series of events in our system that lead to a rebalancing of the users' portfolios. This rebalancing of active portfolio investments to their target allocation is done through the execution of a set of individual orders. As described in [Understanding portfolio orders](/products/tol/guides/portfolios/understanding_portfolio_orders), a set of orders in the context of the Upvest Investment API is called a portfolio order.

In other words, for each account specified in the one-off rebalancing trigger, we create a portfolio order that, when executed (i.e., all individual orders have been executed) rebalances the portfolio investment with its target allocation.