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

# Create vault and deposit in single transaction

> **User Experience Function**: Creates a new DeFindex vault and performs an initial deposit in a single atomic transaction.
    This endpoint combines vault creation and initial deposit, providing a streamlined user experience for launching a new vault with immediate funding. This is ideal for users who want to create and immediately invest in a new vault strategy.



## OpenAPI

````yaml POST /factory/create-vault-deposit
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:
  /factory/create-vault-deposit:
    post:
      tags:
        - Factory
      summary: Create vault and deposit in single transaction
      description: >-
        **User Experience Function**: Creates a new DeFindex vault and performs
        an initial deposit in a single atomic transaction.
            This endpoint combines vault creation and initial deposit, providing a streamlined user experience for launching a new vault with immediate funding. This is ideal for users who want to create and immediately invest in a new vault strategy.
      operationId: FactoryController_createDefindexVaultDeposit
      parameters:
        - 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: >-
          Vault creation and deposit parameters. Note that some parameters may
          be optional.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVaultDepositDto'
            examples:
              Create vault with initial deposit:
                value:
                  roles:
                    emergencyManager: GACKTN5DAZGWXRWB2WLM6OPBDHAMT6SJNGLJZPQMEZBUR4JUGBX2UK7V
                    feeReceiver: GACKTN5DAZGWXRWB2WLM6OPBDHAMT6SJNGLJZPQMEZBUR4JUGBX2UK7V
                    manager: GACKTN5DAZGWXRWB2WLM6OPBDHAMT6SJNGLJZPQMEZBUR4JUGBX2UK7V
                    rebalanceManager: GACKTN5DAZGWXRWB2WLM6OPBDHAMT6SJNGLJZPQMEZBUR4JUGBX2UK7V
                  vaultFeeBps: 25
                  assets:
                    - address: CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                      strategies:
                        - address: >-
                            CDB2WMKQQNVZMEBY7Q7GZ5C7E7IAFSNMZ7GGVD6WKTCEWK7XOIAVZSAP
                          name: Strategy A
                          paused: false
                  name: MyVault
                  symbol: MVLT
                  upgradable: true
                  caller: GACKTN5DAZGWXRWB2WLM6OPBDHAMT6SJNGLJZPQMEZBUR4JUGBX2UK7V
                  depositAmounts:
                    - 100
                    - 200
      responses:
        '200':
          description: Vault creation and deposit transaction prepared successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  xdr:
                    type: string
                    nullable: true
                    description: >-
                      Base64 encoded transaction XDR ready for signing by Vault
                      Manager
                  simulationResponse:
                    type: string
                    description: Simulation result of the transaction
                  error:
                    type: string
                    description: Error message if any
        '400':
          description: Bad request - invalid vault creation or deposit parameters
        '404':
          description: Not found - no factory contract deployed for this network
components:
  schemas:
    CreateVaultDepositDto:
      type: object
      properties:
        roles:
          description: Vault roles configuration
          allOf:
            - $ref: '#/components/schemas/VaultRolesDto'
        vaultFeeBps:
          type: number
          description: Fee amount in basis points (0-10000, where 10000 = 100%)
          example: 25
          minimum: 0
          maximum: 10000
        assets:
          description: Assets and their strategies
          example:
            - address: CAWS...
              strategies:
                - address: CXAO...
                  name: Strategy1
                  paused: false
                - address: CVXA...
                  name: Strategy2
                  paused: true
          type: array
          items:
            $ref: '#/components/schemas/AssetStrategySetDto'
        name:
          type: string
          description: Vault name
          example: MyVault
          minLength: 1
          maxLength: 32
        symbol:
          type: string
          description: Vault symbol
          example: MVLT
          minLength: 1
          maxLength: 10
        upgradable:
          type: boolean
          description: Indicates if the vault is upgradable
        caller:
          type: string
          description: >-
            Caller address, the address that will call the vault creation and
            sign the transaction
          example: GQWE...
        depositAmounts:
          description: Deposit amounts
          example:
            - 100
            - 200
          type: array
          items:
            type: number
      required:
        - roles
        - vaultFeeBps
        - assets
        - name
        - symbol
        - upgradable
        - caller
        - depositAmounts
    VaultRolesDto:
      type: object
      properties:
        emergencyManager:
          type: string
          description: Emergency manager address
          example: GBAJGSZQRZDMHKU4DAS6FEJM7TYISAME5LNERKOT7XLMNFZ5IF5ROXOQ
        rebalanceManager:
          type: string
          description: Rebalance manager address
          example: GBAJGSZQRZDMHKU4DAS6FEJM7TYISAME5LNERKOT7XLMNFZ5IF5ROXOQ
        feeReceiver:
          type: string
          description: Fee receiver address
          example: GBAJGSZQRZDMHKU4DAS6FEJM7TYISAME5LNERKOT7XLMNFZ5IF5ROXOQ
        manager:
          type: string
          description: Vault manager address
          example: GBAJGSZQRZDMHKU4DAS6FEJM7TYISAME5LNERKOT7XLMNFZ5IF5ROXOQ
      required:
        - emergencyManager
        - rebalanceManager
        - feeReceiver
        - manager
    AssetStrategySetDto:
      type: object
      properties:
        address:
          type: string
          description: Asset address
          example: GDAF...
        strategies:
          description: Strategies associated with the asset
          type: array
          items:
            $ref: '#/components/schemas/StrategyDto'
      required:
        - address
        - strategies
    StrategyDto:
      type: object
      properties:
        address:
          type: string
          description: Strategy address
        name:
          type: string
          description: Strategy name
        paused:
          type: boolean
          description: Indicates if the strategy is paused
      required:
        - address
        - name
        - paused

````

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