Skip to main content
This guide walks through a complete RebelFi integration — from setup through yield generation and withdrawal. Every step includes working code. The same flow applies whether you’re building for an exchange, neobank, payment processor, or any other use case.

Prerequisites

1

Create a Wallet Profile

Go to Settings → Wallet Profiles in the dashboard. Create a profile with the blockchains you need enabled. See Wallet Profiles for details.
2

Generate an API Key

Go to Settings → API Keys. Generate a key and attach it to your Wallet Profile. Copy the key immediately — it’s shown only once.
3

Install the SDK

1. Register a Wallet

Register the wallet you want to deploy funds from. This is idempotent — calling it again with the same address returns the existing wallet.
The optional userId field links this wallet to your internal user. You can later query allocations and earnings by userId instead of wallet address.

Update metadata

Attach arbitrary metadata to a wallet:

List wallets

Query wallets for a user or by blockchain:

2. Discover Venues and Strategies

Find available yield opportunities:
Pick a strategy to use:

3. Check Pre-Supply Allocations

Before supplying, verify the user’s current positions:

4. Supply Flow

Create the operation

expiresAt is five minutes after planning. Sign and submit before then: past it, getUnsignedTransactions() and submitSigned() fail with OPERATION_EXPIRED and the operation becomes EXPIRED. On EVM, the supply that follows an approve gets a fresh five minutes once the approve is submitted; read expiresAt again with operations.get().

Sign the transaction

The operation contains an unsigned transaction. Have the user sign it:

Broadcast and submit hash

Option A — You broadcast:
RebelFi records the hash only if it is the transaction it planned; anything else fails with TRANSACTION_MISMATCH. Option B — RebelFi broadcasts:
If the call fails, resubmitting the same signedTxBase64 is always safe. Sign again only when RebelFi says so: see Retrying safely.

Poll for confirmation

5. Identifier Equivalence

After supply, you can query allocations and earnings using any wallet identifier — they all return the same data:
The same applies to the get and earnings methods. Use whichever identifier is most convenient.

6. Monitor Yield

Check allocations

Get earnings history

7. Unwind (Withdraw)

When the user wants to withdraw, create an unwind operation:

8. Cancel Flow

Cancel a pending operation that hasn’t been submitted:
You rarely need to cancel your own plan: a new plan on the same wallet with the same API key replaces it (its ID is in cancelledOperations), unless a transaction was submitted or reported for it. A plan made by another API key or a dashboard user is not replaced: the new plan fails with OPERATION_IN_PROGRESS until that one is submitted, passes its expiresAt, or is cancelled.

9. Error Handling

See the Error Handling guide for comprehensive patterns including retry logic.

Next Steps

Error Handling

Comprehensive error handling patterns

TypeScript Reference

Complete type definitions