Close a borrow position for an end user smart account
Closes an end user smart account’s borrow position by fully repaying its outstanding loan and withdrawing all remaining collateral back to the smart account, in a single user operation.
A borrow position is identified by the smart account address and the borrowProductId in the request body, since a smart account holds at most one position per borrow product. Closing repays the entire accrued debt and withdraws the full collateral balance; there is no partial close. To adjust a position without closing it, use adjustBorrowPositionWithEndUserAccount instead.
A user operation is broadcast to close the position onchain. Poll getUserOperationWithEndUserAccount with the returned userOpHash until it reaches a terminal state. Once the user operation succeeds onchain, the position is closed and no longer appears in the borrow positions list.
Authorizations
Headers
A JWT signed using your Wallet Secret, encoded in base64. Refer to the Generate Wallet Token section of our Authentication docs for more details on how to generate your Wallet Token.
Path Parameters
Query Parameters
Body
A request to close an end user smart account's borrow position for the specified borrow product.
Closing fully repays the position's outstanding loan and withdraws all remaining collateral back to the smart account, broadcasting a single user operation to settle the position onchain. There is no partial close; use adjustBorrowPositionWithEndUserAccount to adjust a position without closing it.
Paymaster URL to use for the user operation. Must not be set when useCdpPaymaster is true.
If useCdpPaymaster is false and no paymasterUrl is set, the smart account must have sufficient funds to cover network fees.
11 - 2048^https?://.*$"https://api.developer.coinbase.com/rpc/v1/base/AbCdEf123456"
Response
Successfully broadcast the user operation to close the borrow position.
A smart account operation response.
The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
^0x[0-9a-fA-F]{64}$"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"