---
title: "Update Portfolio by ID"
method: PATCH
path: "/v1/rebalancing/portfolios/{portfolio_id}"
tags: ["Rebalancing"]
---

# Update Portfolio by ID

`PATCH /v1/rebalancing/portfolios/{portfolio_id}`

## Request

- Base URL: `https://broker-api.giftcity.sandbox.in.alpaca.markets`
- URL: `https://broker-api.giftcity.sandbox.in.alpaca.markets/v1/rebalancing/portfolios/{portfolio_id}`
- Auth: HTTP basic

Updates a portfolio. If weights or conditions are changed, all subscribed accounts will be evaluated for rebalancing at the next opportunity (normal market hours). If a cooldown is active on the portfolio, the rebalancing will occur after the cooldown expired.

## Request body

- object
  - `cooldown_days` integer, required: Used to update portfolio cooldown days.
  - `description` string: Used to update portfolio description.
  - `name` string: Used to update portfolio name.
  - `rebalancing_conditions` RebalancingConditions[]: Used to update portfolio conditions.
    - `day` string: Used to specify the rebalancing day for conditions of type = calendar. Only permitted and required for type = calendar. In scenarios when the specified day aligns to a non-trading day, the rebalance will be triggered on the preceding trading day. For type= annually, the value must be passed in MM-DD format. If 02-29 is specified and the current year is not a leap year, the rebalance will occur on the trading day preceding 2/29. For type= quarterly and monthly the value must be an integer between 1 and 31 inclusive. This represents the day of month. For quarterly, rebalancing will trigger on this day in January, March, June, and December. If the specified day is non-existent for the month then the rebalancing will trigger on the preceding trading day. For type = weekly, permitted values are Monday, Tuesday, Wednesday, Thursday, Friday.
    - `percent` string: Must be a positive value, up to two decimal places. Only permitted and required for type = drift_band. This is the max allowable drift percent from any target weight (+/-)
    - `sub_type` string: For type = drift_band: absolute or relative. For type = calendar: weekly,monthly, quarterly or annually. For type = on_portfolio_update: there is no subtype
    - `type` string: Possible values of drift_band, calendar or on_portfolio_update
  - `weights` PortfolioWeightRequest[]: Used to update portfolio weights.
    - union: Weight entry in a portfolio create or update request, selected by `type`.
      - PortfolioWeightCashEntry: A cash weight. `symbol` is optional and may be null.
        - `percent` string, decimal, required: Percentage allocated to this weight. Values must be greater than zero, and all supplied weights must total exactly 100.
        - `symbol` string, nullable: Asset symbol. Required and non-null when `type` is `asset`.
        - `type` 'cash', required: Type of weight entry in a portfolio.
      - PortfolioWeightAssetEntry: An asset weight. `symbol` is required.
        - `percent` string, decimal, required: Percentage allocated to this weight. Values must be greater than zero, and all supplied weights must total exactly 100.
        - `symbol` string, nullable, required: Asset symbol. Required and non-null when `type` is `asset`.
        - `type` 'asset', required: Type of weight entry in a portfolio.

## Response `200`

The updated portfolio

- Portfolio
  - `cooldown_days` integer, required: Count of calendar days following a rebalance before a subscription is eligible to trigger another rebalance
  - `created_at` string: Portfolio creation timestamp
  - `description` string: Text to describe portfolio
  - `id` string: Portfolio ID
  - `name` string: Name of portfolio
  - `rebalancing_conditions` string: Rebalancing conditions for portfolio
  - `status` 'active' | 'inactive' | 'needs_adjustment': Current status of portfolio
  - `updated_at` string: Portfolio updated timestamp
  - `weights` PortfolioWeights[]: Weight configuration to portfolio. Sum of "percent" values in the weights array must be 100.00
    - `percent` string, required: Percentage allocated to this weight as a decimal string.
    - `symbol` string, nullable, required: Asset symbol. `null` for cash weights. Always present.
    - `type` 'cash' | 'asset', required: Type of weight entry in a portfolio.

## Other responses

- `400`: The request body is missing, is not valid JSON, or has a value of the wrong type. Send a JSON body that matches the endpoint and try again.
- `401`: The request is not authenticated. Send a valid API key ID and secret, or a Broker Dashboard session, and try again.
- `403`: These credentials are not allowed to call this endpoint, or rebalancing is not enabled for the correspondent. Use credentials with the required permission and try again.
- `404`: No portfolio with this ID exists for your correspondent. Check the portfolio ID and try again.
- `415`: The Content-Type header is not application/json. Set Content-Type to application/json and send the body again.
- `422`: The request failed validation or cannot be completed in its current state. The message describes the reason.
- `500`: Something went wrong on our side while handling the request. Retry with backoff. If it keeps happening, contact support.

---

[API](https://skmtc.dev/alpacahq/apis/broker-api.md) - [All operations](https://skmtc.dev/alpacahq/apis/broker-api/llms.txt) - [OpenAPI document](https://skmtc.dev/alpacahq/apis/broker-api/revisions/381b1ecb3ccc?raw)
