Build Morpho Blue repayment calls
Builds and simulates wallet calls for repaying exact loan assets, exact borrow shares, or the account's full debt position in a Morpho Blue market. max_repay_assets reports the maximum loan amount that may leave the wallet, including interest accrued since the quote and any referral fee.
For wrapped-native debt, set funding.type to native, erc20, or balance-based auto; mixed funding is not supported. Use signature_mode to choose prerequisite approval calls or automatic ERC-2612 signature selection. Add collateral_amount to withdraw an exact collateral amount in the same atomic action; the API then applies a conservative loan-to-value bound.
Authorization
ApiKeyAuth 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
Morpho Blue market selector formatted as <chain_id>:<market_id>. The chain ID is at most 9007199254740991.
^(?:[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]{64}$Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Repay only, repay and withdraw collateral in one atomic action, or continue a prepared action with collected signatures.
Repay only, repay and withdraw collateral in one atomic action, or continue a prepared action with collected signatures.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v0/actions/blue/markets/{market-selector}/repay" \ -H "Content-Type: application/json" \ -d '{ "account": "0xE85fbc6F0449a92eF958c5a44D4719ddaCE98D6B", "amount": { "unit": "assets", "value": "1000000" }, "funding": { "type": "erc20" } }'{ "data": { "action_id": "act_4dfa40e76ed2468abaa3f7dbd52d684e", "status": "prepared", "chain_id": 8453, "account": "0xE85fbc6F0449a92eF958c5a44D4719ddaCE98D6B", "expires_at": 1791829901, "market": { "id": "0x9103c3b4e834476c9a62ea009ba2c884ee42e94e6e314a26f04d312434191836", "loan_asset": { "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "collateral_asset": { "address": "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf" } }, "amount": { "unit": "assets", "value": "1000000" }, "max_repay_assets": "1000000", "resolved_funding": { "wrapped_asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "max_native_assets": "0", "erc20_assets": "1000000", "native_assets": "0" }, "calls": [ { "id": "call_0", "kind": "approval", "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "data": "0x095ea7b30000000000000000000000004d28d900e381ece4b351302f1abe588496793a2b00000000000000000000000000000000000000000000000000000000000f4240", "value": "0" }, { "id": "call_1", "kind": "blue_repay", "to": "0x4D28D900e381eCE4B351302f1Abe588496793A2b", "data": "0x827d6bd8000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000cbb7c0000ab88b473b1f5afd9ef808440eed33bf000000000000000000000000663becd10dae6c4a3dcd89f1d76c1174199639b900000000000000000000000046415998764c29ab2a25cbea6254146d50d226870000000000000000000000000000000000000000000000000bef55718ad6000000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006acd278d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000006acd208622221111", "value": "0" } ], "action": "blue.repay", "simulation": { "status": "success", "block": { "number": "52519378", "timestamp": 1791828103 }, "wallet_changes": [ { "asset": { "type": "erc20", "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, "difference": "-1000000" } ], "position_changes": { "supply_shares": "0", "borrow_shares": "-890020077263", "collateral_assets": "0" }, "effects": { "repaid_assets": "1000000", "repaid_shares": "890020077263", "referral_fee_assets": "0" } }, "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 Morpho Blue market was not found on this chain.
{ "error": { "code": "MARKET_NOT_FOUND", "message": "The Morpho Blue market does not exist on this chain.", "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" }}{ "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": "Chain state is temporarily unavailable.", "details": null, "request_id": "req_0123456789abcdef" }}POSTBuild Morpho Blue refinance calls
Builds and simulates wallet calls for moving an account's complete live debt and collateral between distinct existing markets on the registered Morpho Blue…
POSTBuild Morpho Blue collateral-supply calls
Builds and simulates wallet calls for supplying an exact collateral-asset amount to an existing market on the registered Morpho Blue deployment.