> ## Documentation Index
> Fetch the complete documentation index at: https://docs.defindex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Rebalance vault strategies

> **Manager Function - Rebalance Manager**: Rebalances the strategies within a vault to optimize asset allocation and performance. This operation adjusts the distribution of assets across strategies based on predefined criteria or market conditions.



## OpenAPI

````yaml POST /vault/{address}/rebalance
openapi: 3.0.0
info:
  title: DeFindex API
  description: API documentation for DeFindex endpoints
  version: 1.0.0
  contact: {}
  x-logo:
    url: https://links.paltalabs.io/defindex-full.svg
    backgroundColor: '#0e0e0e'
    altText: DeFindex Logo
    href: https://defindex.io
servers: []
security: []
tags: []
paths:
  /vault/{address}/rebalance:
    post:
      tags:
        - Vault
      summary: Rebalance vault strategies
      description: >-
        **Manager Function - Rebalance Manager**: Rebalances the strategies
        within a vault to optimize asset allocation and performance. This
        operation adjusts the distribution of assets across strategies based on
        predefined criteria or market conditions.
      operationId: VaultController_rebalance
      parameters:
        - name: address
          required: true
          in: path
          description: Stellar address of the vault contract
          schema:
            example: CBNKCU3HGFKHFOF7JTGXQCNKE3G3DXS5RDBQUKQMIIECYKXPIOUGB2S3
            type: string
        - name: network
          required: true
          in: query
          description: Stellar network to execute the transaction on (testnet or mainnet)
          schema:
            enum:
              - testnet
              - mainnet
            type: string
      requestBody:
        required: true
        description: >-
          Rebalance parameters. This operation may include instructions for
          asset allocation, strategy adjustments, or other rebalancing criteria.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RebalanceDto'
            examples:
              Rebalance with instructions:
                value:
                  instructions:
                    - type: Invest
                      strategy_address: CDB2WMKQQNVZMEBY7Q7GZ5C7E7IAFSNMZ7GGVD6WKTCEWK7XOIAVZSAP
                      amount: 500000
                    - type: Unwind
                      strategy_address: CCBTSHPUVNKCT5V675AAVYNANHXBU26PTZK2QLS7ZLFNYRJZT5HW3VL6
                      amount: 300000
              Rebalance with swap:
                value:
                  instructions:
                    - type: SwapExactIn
                      token_in: CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                      token_out: CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA
                      amount: 100000
                      slippageToleranceBps: 50
      responses:
        '200':
          description: Transaction prepared successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  xdr:
                    type: string
                    description: Base64 encoded transaction XDR ready for signing
                  simulationResponse:
                    type: object
                    description: Simulation result of the transaction
                  functionName:
                    type: string
                    description: Function name for the operation
                  params:
                    type: object
                    description: Parameters used for the operation
        '400':
          description: Bad request - invalid parameters
        '403':
          description: Forbidden - caller is not authorized for this operation
components:
  schemas:
    RebalanceDto:
      type: object
      properties:
        caller:
          type: string
          description: >-
            Stellar address of the user initiating the rebalance. Must be a
            valid Stellar public key **with Manager or rebalance manager role.**
          example: GB7NTQG4EXB7NZEA5GNFHIHEQVTGQTZ6OWKWUD535FBEHNSEVCKZULIY
        instructions:
          type: array
          description: >-
            Array of rebalance instructions. Each instruction must be a valid
            strategy or swap operation.
          example:
            - type: Invest
              strategy_address: CDB2WMKQQNVZMEBY7Q7GZ5C7E7IAFSNMZ7GGVD6WKTCEWK7XOIAVZSAP
              amount: 500000
            - type: Unwind
              strategy_address: CCBTSHPUVNKCT5V675AAVYNANHXBU26PTZK2QLS7ZLFNYRJZT5HW3VL6
              amount: 300000
            - type: SwapExactIn
              token_in: CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
              token_out: CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA
              amount: 100000
              slippageToleranceBps: 50
      required:
        - caller
        - instructions

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.