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

# Open Position

> Opens a lending position: advances funds from Vanish's trading accounts into the position's one-time wallet and runs your own instructions against them in the same transaction. Vanish wraps the unsigned transaction supplied in `main_tx`, signs it, and simulates it, then either returns the signed transaction for you to broadcast or - if the wrapped transaction exceeds Solana's size limit - submits a two-transaction Jito bundle itself.

Follow every open with [`POST /borrow/commit`](/api-reference/lending/commit). Requires a signature valid for 10 minutes; see [Signing Requests](/guide/integration/signing#signing-requests) and the [Lending Flow](/guide/integration/lending#open-a-position).



## OpenAPI

````yaml POST /borrow/initiate
openapi: 3.0.1
info:
  title: Vanish Core API
  description: API endpoints for the Vanish Core service.
  license:
    name: MIT
  version: 2.0.0
servers:
  - url: https://core-api-dev.vanish.trade
security:
  - ApiKeyAuth: []
paths:
  /borrow/initiate:
    post:
      summary: Open Position
      description: >-
        Opens a lending position: advances funds from Vanish's trading accounts
        into the position's one-time wallet and runs your own instructions
        against them in the same transaction. Vanish wraps the unsigned
        transaction supplied in `main_tx`, signs it, and simulates it, then
        either returns the signed transaction for you to broadcast or - if the
        wrapped transaction exceeds Solana's size limit - submits a
        two-transaction Jito bundle itself.


        Follow every open with [`POST
        /borrow/commit`](/api-reference/lending/commit). Requires a signature
        valid for 10 minutes; see [Signing
        Requests](/guide/integration/signing#signing-requests) and the [Lending
        Flow](/guide/integration/lending#open-a-position).
      requestBody:
        description: Details of the request to open a position.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BorrowInitiateRequest'
        required: true
      responses:
        '200':
          description: Successful lending action response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowActionResponse'
        '400':
          description: >-
            Bad request. The amount is not greater than 0, the one-time wallet
            was not found or does not belong to this user, the balance available
            for the token is insufficient, the transaction failed simulation, or
            an action was already initiated with this signature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowError'
        '401':
          description: >-
            Unauthorized. The request is missing a valid API key or the
            signature is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowError'
        '429':
          description: >-
            Rate limit exceeded. Contact the Vanish team to raise your team's
            requests-per-second cap.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowError'
components:
  schemas:
    BorrowInitiateRequest:
      required:
        - smart_wallet_id
        - user_address
        - source_token_address
        - amount
        - loan_additional_sol
        - jito_tip_amount
        - main_tx
        - timestamp
        - user_signature
      type: object
      properties:
        smart_wallet_id:
          description: >-
            Identifier of the one-time wallet the funds are advanced into,
            returned by the /borrow/smart-wallet endpoint. Must belong to
            user_address.
          type: integer
          example: 4821
        user_address:
          description: The Solana wallet address of the user opening the position.
          type: string
        source_token_address:
          description: >-
            The address of the token being advanced into the one-time wallet.
            Wrapped SOL is normalised to native SOL after the signature check.
          type: string
        amount:
          description: >-
            The amount to advance into the one-time wallet, expressed in the
            smallest unit (e.g., lamports for SOL). Must be greater than 0. Can
            be provided as a string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        loan_additional_sol:
          description: >-
            Additional SOL (in lamports) advanced alongside the token, typically
            used for ATA creation and account initialization. The one-time
            wallet starts empty, so this is required the first time the position
            uses a given token: one ATA costs approximately 2039280 lamports.
            Pass 0 when the wallet already holds enough. Can be provided as a
            string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        jito_tip_amount:
          description: >-
            The amount of Jito tip, expressed in the smallest unit (e.g.,
            lamports for SOL). Only applied when the wrapped transaction
            overflows Solana's size limit and a two-transaction bundle is used
            instead, but always required - it is part of the signed message
            either way. Can be provided as a string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        main_tx:
          description: >-
            Serialized or encoded transaction data carrying your own deposit or
            open instructions. The transaction must be provided unsigned, with
            the one-time wallet address set as the signer.
          type: string
        timestamp:
          description: >-
            Unix timestamp of when the position was opened (in milliseconds).
            Must be within 10 minutes of server time. Can be provided as a
            string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        user_signature:
          description: >-
            A digital signature of 'By signing, I hereby agree to Vanish's Terms
            of Service and agree to be bound by them
            (docs.vanish.trade/legal/TOS)


            Details:
            borrow:{smart_wallet_id}:{source_token_address}:{amount}:{loan_additional_sol}:{timestamp}:{jito_tip_amount}',
            signed by the user's wallet.
          type: string
    BorrowActionResponse:
      required:
        - action_id
        - tx_id
      type: object
      properties:
        action_id:
          description: Identifier of this lending or settle action.
          type: integer
          example: 88213
        tx_id:
          description: Transaction signature of the action. Poll it via /borrow/commit.
          type: string
        transaction:
          description: >-
            Base64-encoded signed transaction for you to broadcast. Null when
            Vanish submitted a Jito bundle instead; always populated for settle.
          type: string
          nullable: true
        jito_bundle_id:
          description: >-
            If the wrapped transaction was too large for a single transaction
            and Vanish submitted a two-transaction Jito bundle, its bundle ID;
            otherwise null. When set, there is nothing for you to broadcast.
            Always null for settle.
          type: string
          nullable: true
    BorrowError:
      required:
        - error
      type: object
      properties:
        error:
          description: >-
            The error code or short description. Endpoint errors use the HTTP
            status text (for example '400 Bad Request'); errors raised by the
            API key middleware and the rate limiter carry the description here
            instead.
          type: string
        message:
          description: >-
            The specific reason for the failure. Null on a signature
            verification failure, and absent entirely on API key and rate limit
            errors - check for the presence of this field rather than assuming
            every error body has the same shape.
          type: string
          nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````