Skip to main content
A borrow takes a loan out against collateral in a lending market and sends the borrowed token to your wallet. There are two ways to do it, and the tabs on this page follow them. From a position: you already have collateral in the market, say aWETH on Aave, and you just want to borrow against it. Deposit & borrow: you start with a plain token, and one transaction supplies it as collateral and borrows against it right away. Borrows go through the bundle endpoints (getZapBundleQuote / buildZapBundleTx), because a borrow is an action you chain with others rather than a single srcToken → destToken hop. They also need one thing the other zaps don’t: a signature from you, made before the transaction is built. The steps below show where it fits. Pre-execution steps explains why it’s needed and what to watch for, and it’s worth reading before you ship. Borrowing is EVM-only for now.

Setup

Both examples use Aave v3 on Base, signing with walletClient, a viem wallet client built from the private key in PRIVATE_KEY. Amounts are strings in the token’s smallest unit, and no API key is needed.
The collateral is named by its position token, the aToken here, not by the underlying asset. Find it with getZapPools, and your current positions with getZapPositions.

Steps

1

Quote

A single borrow action. srcToken is the collateral position you already hold, with no amount, because nothing moves out of it: the aWETH stays where it is and backs the loan. destToken is what you want to borrow, and destAmount how much. Leave destAmount out and DZap borrows the most your collateral allows.
2

Sign the delegation

No token approval here, since your collateral never leaves Aave. The only thing to authorize is the borrow itself: sign the credit delegation the quote asked for (see Pre-execution steps). prepareZapPreExecutionData doesn’t throw. Like approve() and zap(), it hands back a status, so if the user rejects the signature you get rejected and an errorMsg to show.
3

Build & send

Add the signatures to the request and build. buildZapBundleTx checks the borrow against your Aave account, so it throws if you’re asking for more than your collateral covers. zap() then sends the transaction, and the USDC lands at recipient.
4

Status

Poll getZapTxnStatus with the transaction hash until it leaves PENDING. DZap answers 404 until it has seen the transaction and 429 when you hit the rate limit, so the catch lets only those two through. It gives up after 5 minutes.

End-to-end

API usage

The same flow over REST, on the bundle endpoints at https://zap.dzap.io/v1/bundle. Each response wraps its result in data.
Before building, sign each entry in the quote’s data.preExecutionSteps and send the results as preExecutionStepsData. Pre-execution steps shows how to do that without the SDK. Then send the build’s steps[0].data (callTo, callData, value) from your wallet. Full reference: Bundle, Status.
Last modified on October 10, 2026