Skip to main content
Set autoRebalance: false when creating the wallet so your application controls exact dollar allocations and deposits remain in cash until you allocate them. Store your API key in GROUND_API_TOKEN. The examples below use the sandbox API:

1. Create a wallet for each customer

Create a wallet without auto-rebalancing by setting autoRebalance: false. Save the Ground wallet ID on your customer record.
Subscribe to portfolio_wallet.status_changed before creating the wallet. When the matching walletId reaches idle, read GET /v2/wallets/{id} and show the customer the appropriate deposit address. Handle failed as a provisioning failure, and use the wallet read to reconcile a delayed or missed webhook.

2. Receive the completed deposit

Subscribe to portfolio_wallet.deposit.status_changed or poll the wallet’s deposits. Allocate funds only after the deposit becomes completed. Verify the webhook signature before parsing it, and deduplicate deliveries with the Ground-Event-Id header.
Use cashPositionId as the source when allocating this deposit. IDs are unique to each environment, so do not reuse sandbox IDs in production. See Webhook signature verification for the complete verification flow. Use the wallet read as a fallback when a webhook is delayed or missed.

3. Allocate the cash

Fetch GET /v2/wallets/yield-sources and use a returned source id as the destination. Send the same allocations array to preview and create.
The response includes the rebalanceId, requestId, createdAt, current status, and accepted allocations. Returned dollar amounts use six decimal places. Track portfolio_wallet.rebalance.status_changed or rebalance activity until it finishes. If Ground returns workflow_conflict, wait for the active withdrawal or rebalance to finish, then retry.

4. Read or change an allocation

Read the wallet to get the customer’s current cash and investments:
To move an existing investment, use IDs from wallet.positions:

5. View yield

Read the customer’s lifetime earnings, estimated annualized yield, and current breakdown by yield source:
This response can be shown directly in the customer-facing application. See Calculating Yield Accrual for display and calculation guidance.

6. Withdraw funds

Omit sources to let Ground choose the positions. To withdraw from specific positions, include the amount from each source. Source amounts must add up to amountUsd, and each source must contribute at least $0.01.
Send the same source amounts to preview and create. Track portfolio_wallet.withdrawal.status_changed until the withdrawal finishes.

Test the integration

In sandbox:
  1. Create a wallet without automatic rebalancing and save its ID on a test customer.
  2. Deposit test USDC and confirm the completed deposit includes cashPositionId.
  3. Allocate part of the cash to two yield sources.
  4. Confirm the rebalance finishes and the wallet returns the new positions.
  5. Confirm GET /v2/wallets/{id}/yield returns the customer’s yield summary.
  6. Move funds between two existing positions.
  7. Complete one automatic withdrawal and one selected-source withdrawal.
Save each requestId before sending a request. If the request times out, retry with the same ID and body.