Docs

Build Vault V2 force-withdrawal calls

Builds and simulates Vault V2 force exits when the vault lacks idle liquidity.


POST
/v0/actions/vaults-v2/{vault-selector}/force-withdraw

Vaults containing a Midnight adapter are unsupported. Set amount to { unit: "assets", value } for an exact asset amount, or to { unit: "all" } with max_penalty_bps for the full position. If a full exit cannot be safely planned within max_penalty_bps, retry with an assets amount; the service returns ACTION_UNSUPPORTED (422). The exit may incur a force-deallocate penalty reported in simulation.effects.penalty_assets. For an amount: { unit: "all" } request, residual_shares is the planned vault shares remaining after the all-position force-redeem; simulation.effects.remaining_shares reports the vault shares the simulation left in the account and can differ slightly. For an assets amount, the returned force-withdraw call reverts after expires_at; for { unit: "all" }, expires_at is an off-chain response-validity time and the returned force-redeem multicall has no on-chain deadline. Set signature_mode to request vault-share Permit typed data instead of an approval call when available.

Authorization

ApiKeyAuth
x-api-key<token>

Send your Morpho-issued key on every action request. JWKS needs no key on every host; public documentation needs no key.

In: header

Path Parameters

vault-selector*string

Vault identifier formatted as <chain_id>:<vault_address>. The colon may be sent literally or as %3A. Mixed-case addresses must use a valid EIP-55 checksum.

Match^(?:[1-9][0-9]{0,14}|[1-8][0-9]{15}|900[0-6][0-9]{12}|90070[0-9]{11}|90071[0-8][0-9]{10}|900719[0-8][0-9]{9}|9007199[0-1][0-9]{8}|90071992[0-4][0-9]{7}|900719925[0-3][0-9]{6}|9007199254[0-6][0-9]{5}|90071992547[0-3][0-9]{4}|9007199254740[0-8][0-9]{2}|90071992547409[0-8][0-9]{1}|9007199254740990|9007199254740991):0x[0-9a-fA-F]{40}$

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v0/actions/vaults-v2/{vault-selector}/force-withdraw" \  -H "Content-Type: application/json" \  -d '{    "account": "0x545b6Cc751F0C47C202694cf835db2E3C071400A",    "amount": {      "unit": "assets",      "value": "1000000"    },    "slippage_bps": 3  }'

{  "data": {    "action_id": "act_0123456789abcdef0123456789abcdef",    "chain_id": 8453,    "account": "0x545b6Cc751F0C47C202694cf835db2E3C071400A",    "expires_at": 4000000000,    "vault": {      "address": "0xbeef0e0834849aCC03f0089F01f4F1Eeb06873C9",      "asset": {        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"      }    },    "status": "prepared",    "action": "vault_v2.force_withdraw",    "amount": {      "unit": "assets",      "value": "1000000"    },    "slippage_bps": 3,    "calls": [      {        "id": "call_0",        "kind": "vault_v2_force_withdraw",        "to": "0xE52E169C342C096C4949ABb944DC9f30E3F5Ea84",        "data": "0x902118db000000000000000000000000beef0e0834849acc03f0089f01f4f1eeb06873c9000000000000000000000000fdd31cdf6712c47a4e67037d9f2e35587f5404c000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ee6b28000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ee6b2800",        "value": "0"      }    ],    "simulation": {      "status": "success",      "block": {        "number": "21000000",        "timestamp": 1760000000      },      "wallet_changes": [        {          "asset": {            "type": "erc20",            "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"          },          "difference": "990000"        }      ],      "position_changes": {        "vault_shares": "-1000000"      },      "effects": {        "received_assets": "990000",        "referral_fee_assets": "0",        "penalty_assets": "10000",        "remaining_shares": "10"      }    },    "resolved_amount": {      "unit": "assets",      "value": "1000000"    }  }}

The amount must be a positive decimal string that fits uint256.

{  "error": {    "code": "VALIDATION_FAILED",    "message": "Validation failed",    "details": [      {        "code": "invalid_format",        "message": "Expected a positive decimal string",        "path": [          "amount",          "value"        ]      },      {        "code": "custom",        "message": "Expected an amount that fits in uint256",        "path": [          "amount",          "value"        ]      }    ],    "request_id": "req_0123456789abcdef"  }}

The selected address is not a supported vault deployment.

{  "error": {    "code": "VAULT_NOT_FOUND",    "message": "The vault is not deployed by the registered Vault V2 factory.",    "details": null,    "request_id": "req_0123456789abcdef"  }}

Request bodies must not exceed 16384 bytes.

{  "error": {    "code": "PAYLOAD_TOO_LARGE",    "message": "Request body too large.",    "details": [      {        "code": "too_big",        "message": "Request body exceeds the 16384-byte limit",        "path": [          "body"        ]      }    ],    "request_id": "req_0123456789abcdef"  }}

Restart the same action without the continuation, sign the newly returned typed data, then finalize with the new continuation.

{  "error": {    "code": "SIGNATURE_REFRESH_REQUIRED",    "message": "The prepared signature nonce or deadline is no longer usable.",    "details": null,    "request_id": "req_0123456789abcdef"  }}

Empty
{  "error": {    "code": "INTERNAL_ERROR",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}

Chain state is temporarily unavailable; retry.

{  "error": {    "code": "STATE_UNAVAILABLE",    "message": "The vault state cannot be read right now.",    "details": null,    "request_id": "req_0123456789abcdef"  }}