Skip to main content
Enable automatic rebalancing when Ground should keep funds near percentage targets. Ground deploys deposits and rebalances the wallet as balances change. Store your API key in GROUND_API_TOKEN. The examples below use the sandbox API:

1. Fetch yield sources

Fetch the available yield sources before creating the wallet. Use the returned id and depositToken values when building the strategy.

2. Create the wallet

Allocations for each token must total 100%.
The response starts with status: "creating". Subscribe to portfolio_wallet.status_changed before creating the wallet. When the matching walletId reaches idle, read GET /v2/wallets/{id} to get its deposit addresses. Handle failed as a provisioning failure, and use the wallet read to reconcile a delayed or missed webhook.

3. Deposit funds

Send a supported stablecoin to the matching deposit address. Ground credits the deposit and deploys the funds toward the target percentages. Subscribe to these events or poll the related resources: Wait for the deposit to become completed before using it in your application. See Deposits.

4. Read or update the portfolio

Read the wallet to get its current cash, investments, and balances:
Ground continues to maintain the target percentages. To change them, call PATCH /v2/wallets/{id}/strategy.

5. View yield

Read lifetime earnings, estimated annualized yield, and the current breakdown by yield source:
See Calculating Yield Accrual for display and calculation guidance.

6. Withdraw funds

Do not specify funding sources while automatic rebalancing is enabled. Ground chooses the positions used for the withdrawal.
Track portfolio_wallet.withdrawal.status_changed until the withdrawal finishes. If it requires customer approval, complete the configured transaction approval.

Test the integration

In sandbox:
  1. Create a wallet with automatic rebalancing and wait for idle.
  2. Deposit test USDC to depositAddresses.ethereum_sepolia.
  3. Confirm the deposit completes and a rebalance deploys the funds.
  4. Confirm GET /v2/wallets/{id} returns the new positions.
  5. Confirm GET /v2/wallets/{id}/yield returns the yield summary.
  6. Preview and complete a small withdrawal.
Switch the base URL and API key before using production chain names and addresses.