> ## 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 a new vault

> **Manager Function - Vault Manager**: Creates a new DeFindex vault with the specified configuration parameters.
    This endpoint allows authorized vault managers to deploy new vault contracts through the factory. The vault will be configured with the provided assets, strategies, and management parameters. This is typically used during the initial setup phase of a new investment strategy.



## OpenAPI

````yaml POST /factory/create-vault
openapi: 3.0.0
info:
  title: DeFindex API
  description: >-
    Yield infrastructure for neobanks, fintechs and wallets.


    **Base URL:** `https://api.defindex.io`. Every route takes
    `?network=mainnet` (the default) or `?network=testnet`.


    **Auth:** send your API key as `Authorization: Bearer sk_...` (the console
    uses the JWT access token from `POST /login` the same way). Each operation's
    `security` says whether it needs one; `security: []` means it is public.

    - `401`: no credential, or an invalid API key. The body has a `code`
    (`MISSING_CREDENTIAL` or `INVALID_API_KEY`) and a `registerUrl` where you
    get a key, and `WWW-Authenticate` is set.

    - `403`: an expired or invalid JWT, or a valid credential without the
    required role.


    **Rate limits:** a token bucket per account (requests without a key are
    tracked by IP). Responses carry `X-RateLimit-Limit`, `X-RateLimit-Remaining`
    and `X-RateLimit-Reset` (seconds until the bucket is full). A `429` also
    carries `Retry-After` and `retryAfter` in the body.


    | Tier | Burst | Sustained |

    |---|---|---|

    | FREE | 5 | 1/s |

    | STARTER | 20 | 10/s |

    | PROFESSIONAL | 100 | 50/s |

    | BUSINESS | 200 | 100/s |


    **Units:**

    - Amounts are integers in the asset's smallest unit (7 decimals for every
    asset DeFindex lists today: 1 USDC = `10000000`). Responses send them as
    strings; request bodies take JSON integers.

    - Vault shares (dfTokens) are not underlying: `GET /vault/{address}/balance`
    returns both. The share price rises, so the underlying value of a position
    is not what was deposited.

    - Multi-asset vaults take one amount per vault asset, in the order of
    `assets` in `GET /vault/{address}`.

    - Vault `apy` is a percentage (`8.75` = 8.75%). `/strategies`
    `apy7d`/`apy30d`/`apyAllTime` are fractions (`0.0641` = 6.41%).

    - Fees are basis points (`10000` = 100%).


    **Writes never move funds by themselves.** Each write returns an unsigned
    transaction (`xdr`) for the `caller`. Sign it and submit it with `POST
    /send` (or your own RPC). `POST /send` is idempotent: resubmitting the same
    signed XDR returns the original result.
  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:
    post:
      tags:
        - Factory
      summary: Create a new vault
      description: >-
        **Manager Function - Vault Manager**: Creates a new DeFindex vault with
        the specified configuration parameters.
            This endpoint allows authorized vault managers to deploy new vault contracts through the factory. The vault will be configured with the provided assets, strategies, and management parameters. This is typically used during the initial setup phase of a new investment strategy.
      operationId: FactoryController_createDefindexVault
      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 parameters. All parameters are required for vault
          deployment.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVaultDto'
            examples:
              New vault creation:
                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
      responses:
        '200':
          description: Vault creation 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
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            x-correlation-id:
              $ref: '#/components/headers/x-correlation-id'
        '400':
          description: Bad request - invalid vault creation parameters
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            x-correlation-id:
              $ref: '#/components/headers/x-correlation-id'
        '401':
          description: >-
            No credential, an invalid API key, or a valid JWT of a disabled
            account. Except for the disabled account, the answer carries
            `WWW-Authenticate` and a `registerUrl`.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            x-correlation-id:
              $ref: '#/components/headers/x-correlation-id'
        '403':
          description: Forbidden - caller is not authorized as Vault Manager
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            x-correlation-id:
              $ref: '#/components/headers/x-correlation-id'
        '404':
          description: Not found - no factory contract deployed for this network
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            x-correlation-id:
              $ref: '#/components/headers/x-correlation-id'
        '429':
          description: >-
            Rate limit exceeded for your tier. Wait `Retry-After` seconds and
            retry.
          headers:
            Retry-After:
              description: Seconds until the next request is allowed.
              schema:
                type: integer
                example: 1
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            x-correlation-id:
              $ref: '#/components/headers/x-correlation-id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                    example: 429
                  message:
                    type: string
                    example: Rate limit exceeded
                  error:
                    type: string
                    example: Too Many Requests
                  retryAfter:
                    type: integer
                    example: 1
              example:
                statusCode: 429
                message: Rate limit exceeded
                error: Too Many Requests
                retryAfter: 1
      security:
        - bearer: []
components:
  schemas:
    CreateVaultDto:
      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...
      required:
        - roles
        - vaultFeeBps
        - assets
        - name
        - symbol
        - upgradable
        - caller
    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
  headers:
    X-RateLimit-Limit:
      description: 'Bucket size for your tier: the most requests you can burst.'
      schema:
        type: integer
        example: 5
    X-RateLimit-Remaining:
      description: Requests left in the bucket right now.
      schema:
        type: integer
        example: 4
    X-RateLimit-Reset:
      description: >-
        Seconds (not a timestamp) until the bucket is full again. On a 429,
        seconds until the next request is allowed.
      schema:
        type: integer
        example: 1
    x-correlation-id:
      description: >-
        Request ID. Send your own `x-correlation-id` to have it echoed back;
        quote it when you report a problem.
      schema:
        type: string
        example: 454a42d5-0166-40fe-a4ad-32e77aa44962
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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