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

# Migrate a full position between two DeFindex vaults

> Builds an unsigned, atomic Stellar Router transaction that withdraws the caller's entire share balance from `fromVault` and deposits the proceeds into `toVault`. Both legs live in one transaction, so the migration either fully succeeds or fully reverts. The deposited amount is a floor derived from `slippageBps`; any surplus is left in the caller's wallet.



## OpenAPI

````yaml POST /migration/defindex-to-defindex
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:
  /migration/defindex-to-defindex:
    post:
      tags:
        - Migration
      summary: Migrate a full position between two DeFindex vaults
      description: >-
        Builds an unsigned, atomic Stellar Router transaction that withdraws the
        caller's entire share balance from `fromVault` and deposits the proceeds
        into `toVault`. Both legs live in one transaction, so the migration
        either fully succeeds or fully reverts. The deposited amount is a floor
        derived from `slippageBps`; any surplus is left in the caller's wallet.
      operationId: MigrationController_defindexToDefindex
      parameters:
        - name: network
          required: false
          in: query
          description: Stellar network to use (testnet or mainnet)
          schema:
            enum:
              - testnet
              - mainnet
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DefindexToDefindexDto'
      responses:
        '201':
          description: Unsigned migration transaction built successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  xdr:
                    type: string
                    description: Unsigned transaction XDR (base64)
                  simulationResponse:
                    description: Native-decoded per-invocation return values
                  functionName:
                    type: string
                    example: exec
                  operationXDR:
                    type: string
                    description: Base64-encoded router operation
                  isSmartWallet:
                    type: boolean
                    example: false
        '400':
          description: >-
            Invalid address, `from` is not a G-address, `fromVault` equals
            `toVault`, the two vaults hold different assets, or the position
            rounds to zero after the slippage buffer.
        '404':
          description: The caller holds no shares in `fromVault`.
components:
  schemas:
    DefindexToDefindexDto:
      type: object
      properties:
        from:
          type: string
          description: >-
            User's Stellar public key (G-address). This account holds the source
            vault shares and must sign the returned XDR.
          example: GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG
        fromVault:
          type: string
          description: >-
            Source DeFindex vault contract address. The full share balance held
            by `from` is withdrawn from this vault.
          example: CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR
        toVault:
          type: string
          description: >-
            Target DeFindex vault contract address. Must expose the same assets,
            in the same order, as `fromVault`.
          example: CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W
        slippageBps:
          type: number
          description: >-
            Buffer in basis points applied to the simulated withdrawal proceeds
            before they are deposited into the target vault. 10000 = 100%, 100 =
            1%. Defaults to 10 bps (0.1%). The buffer is left behind in the
            wallet as dust; raising it makes the transaction more resilient to
            price-per-share movement between simulation and submission.
          example: 10
          minimum: 0
          maximum: 10000
          default: 10
      required:
        - from
        - fromVault
        - toVault

````

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