---
title: "Withdraw collateral"
method: POST
path: "/markets/creditbook/collateral/withdraw"
tags: ["creditbook"]
---

# Withdraw collateral

`POST /markets/creditbook/collateral/withdraw`

Withdraws collateral from an existing loan. Full collateral removal may include internal weight-matrix and loan-lock handling before the transaction is returned.

## Headers

- `Idempotent-Key` string, nullable

## Request body

- TxnWithdrawCollateralParams
  - `amount` integer, required
  - `assetIndexGuidance` integer[] — Per-collateral oracle asset-index guidance (one byte per collateral slot).
  - `collateralIndex` integer, required
  - `collateralMint` string, required
  - `expectedLoanValues` ExpectedLoanValuesSchema, required — Expected loan economics the borrower signs off on, checked on-chain against the freshly-priced values to bound slippage.
    - `expectedApy` integer, required — Expected loan APY, in basis points of a hundredth (cbps).
    - `expectedLqt` integer[], required — Expected per-ledger liquidation threshold, one entry per ledger slot.
  - `loan` string, required
  - `lockLoan` boolean
  - `skipClose` boolean
  - `stakeInstructions` StakeLpQueryParams
    - `amount` integer, required
    - `stakeAccount` string, nullable
    - `vault` string, required

## Response `200`

Serialized transaction for withdrawing collateral.

- VersionedTransactionReturn — versioned txn return
  - `message` string, required — serialized message
  - `signatures` VersionedTransactionSignature[], required — serialized signatures
    - `publicKey` string, required — serialized message
    - `signature` string, required — serialized signatures

## Other responses

- `400` — Invalid request
- `401` — Unauthorized
- `409` — Idempotency-Key reused with a different request body
- `500` — Internal server error

---

[API](https://skmtc.dev/loopscale/apis/loopscale-api.md) · [All operations](https://skmtc.dev/loopscale/apis/loopscale-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/loopscale/loopscale-api/revisions/531f64dbe09c/schema)
