Before you start, you need a portal account with at least one active account type. You also need an API key for your server.
1
Install the SDK
2
Initialize the SDK
blend-server.ts
accountTypeId is the slug you chose when creating your account type in the portal.3
Look up the account
lookup.ts
lookupAccount creates the account if it doesn’t exist yet, but does not deploy a Safe. To deploy, scope the account with forAccount and call safe.request(chainId), shown below.4
Scope to the account
scope.ts
client.discover, client.account, and client.sessions.5
Create a session and quote
session-quote.ts
inputAssetAddress. Quote methods return a SessionResult. Narrow on type before reading its quote summary or extracted action plan. The session stays open until you lock it, cancel it, or it expires, which usually takes about 15 minutes.6
Execute the session
execute-server.ts
LOCKED to SETTLED. It does not verify transaction receipts. Repeating the same submission returns the settled session.7
Check the balance
balance-server.ts
What just happened
Your deposit followed this path:- The SDK created a session and requested a quote from Blend’s API.
- Blend built the deposit transaction for your account type’s vault, including any required bridge steps.
- Your server signer submitted the transaction on-chain and paid the gas.
- Funds landed in the user’s Safe and went into that vault.
What to watch out for
Don’t create a new session for every quote. CallquoteDeposit again on the same OPEN session to update the amount, token, or chain. Use forceReset: true only when you want to discard the active session.
Don’t skip error handling. Quotes expire, flow plans can conflict with deposits, and signing can fail. Check error.isRetryable() before retrying.
Don’t hard-code chain IDs or token addresses. Use discover.depositChains() and discover.depositTokens() to build your UI dynamically.
Go-live checklist
1
Store API keys safely
Keep production keys in environment variables or a secrets manager. Never log them or commit them to version control.
2
Rotate API keys
Create fresh API keys for production. Don’t reuse development keys. Deactivate any test keys.
3
Test end-to-end
Make a real deposit and withdrawal on each supported chain. Verify balances update correctly. Test with amounts under $1 to keep costs low.
4
Confirm vault config
Check that your account type’s vault config is Active (not Pending or Provisioning). Deposits to an account type without active infrastructure will fail.
5
Set flow plan mode
Decide whether to auto-approve flow plans or review them manually. Auto-approve is simpler but gives you less control over rebalancing timing.
6
Verify error handling
Test your app’s behavior for expired quotes, signing failures, and
FLOWPLAN_CONFLICT errors. Users should see helpful messages, not stack traces.Once you’ve completed the checklist, your integration is production-ready. Deposits, withdrawals, and rebalancing will work end-to-end.
Using the SDK
Full method reference for account management and session lifecycle.
Deposits and withdrawals
Cross-chain routing, re-quoting, and withdrawal coordination.
Best practices
Credential security, session management, and error recovery patterns.