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

# Withdraw from strategy

> Withdraws principal from an existing lending strategy, optionally closing out the full position.



## OpenAPI

````yaml post /markets/strategy/withdraw
openapi: 3.1.3
info:
  title: Loopscale API
  version: 1.0.0
servers:
  - url: https://tars.loopscale.com/v1
    description: Loopscale Production Server
security: []
paths:
  /markets/strategy/withdraw:
    post:
      tags:
        - Markets
        - Strategy
      summary: Withdraw from strategy
      description: >-
        Withdraws principal from an existing lending strategy, optionally
        closing out the full position.
      operationId: withdrawStrategy
      parameters:
        - name: User-Wallet
          in: header
          required: true
          schema:
            type: string
          description: Wallet address of the lender withdrawing from the strategy.
        - name: payer
          in: header
          required: false
          schema:
            type: string
          description: >-
            Optional fee payer. Defaults to the `User-Wallet` address when
            omitted.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WithdrawStrategyRequest'
      responses:
        '200':
          description: Serialized transaction for the strategy withdrawal.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionedTransactionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/GeneralError'
components:
  schemas:
    WithdrawStrategyRequest:
      type: object
      required:
        - strategy
        - amount
        - withdrawAll
      properties:
        strategy:
          type: string
          description: Onchain address of the target strategy.
        amount:
          type: number
          description: Amount of principal to withdraw, in native token units.
        withdrawAll:
          type: boolean
          description: Set to `true` to withdraw the entire strategy balance.
    VersionedTransactionResponse:
      type: object
      required:
        - message
        - signatures
      properties:
        message:
          type: string
          description: Base64-encoded versioned transaction message.
        signatures:
          type: array
          items:
            $ref: '#/components/schemas/VersionedTransactionSignature'
    VersionedTransactionSignature:
      type: object
      required:
        - publicKey
        - signature
      properties:
        publicKey:
          type: string
        signature:
          type: string
  responses:
    BadRequest:
      description: Bad Request
      content:
        text/plain:
          schema:
            type: string
            example: Invalid strategy address
    GeneralError:
      description: General Server Error
      content:
        text/plain:
          schema:
            type: string
            example: Failed to deserialize the JSON body into the target type.

````