> ## Documentation Index
> Fetch the complete documentation index at: https://docs.groundtech.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Allocate funds

> Preview and submit movements between assets in a manually allocated wallet.

Move available funds between cash, yield sources, and stocks in a wallet with `autoRebalance: false`. A request can contain several movements. Deposits remain cash until you submit one.

## Prerequisites

Use a funded wallet with automatic rebalancing disabled. Set `BASE_URL`,
`GROUND_API_KEY`, and `WALLET_ID` for your environment as described in
[API conventions](https://docs.groundtech.co/v3/docs/portfolio-wallets/api-conventions.md). The examples below
use illustrative asset UUIDs and production network keys. Read source UUIDs
from the wallet and destination asset UUIDs from the catalog in your environment.

## 1. Select positions

Fetch the wallet to select an available cash or yield position, then use the live catalog to choose a compatible destination in the same allocation group.

## 2. Preview the movement

Call [Preview Allocation](https://docs.groundtech.co/v3/api-reference/preview-allocation.md) with
`fromAssetId`, `toAssetId`, and an amount for each fund or stock purchase. These examples show allocations on different networks:

```bash Ethereum USDC theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "$BASE_URL/v3/wallets/$WALLET_ID/allocate-preview" \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "allocations": [
    {
      "fromAssetId": "4ab063cf-303d-4f62-80a6-5a142c1d2fdb",
      "toAssetId": "80f900d0-a4b8-4c97-bdc2-8e2ab5228e19",
      "amountUsd": "10.000000"
    }
  ]
}'
```

```bash Solana USDC theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "$BASE_URL/v3/wallets/$WALLET_ID/allocate-preview" \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "allocations": [
    {
      "fromAssetId": "3427cd0f-8e1a-4639-8768-3cb8c04466a2",
      "toAssetId": "4065f588-8dca-4dcd-b877-0f59eb2275f6",
      "amountUsd": "10.000000"
    }
  ]
}'
```

```bash TRON USDT theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "$BASE_URL/v3/wallets/$WALLET_ID/allocate-preview" \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "allocations": [
    {
      "fromAssetId": "05236267-02a8-4177-9459-0079007151bb",
      "toAssetId": "2e272d44-acbd-43e3-af08-e0b2e90943fb",
      "amountUsd": "10.000000"
    }
  ]
}'
```

## 3. Submit the allocation

After a successful preview, submit the same `allocations` with a fresh UUID
`requestId` to [Allocate](https://docs.groundtech.co/v3/api-reference/allocate.md). To redeem a holding to cash,
use the held investment's `assetId` as `fromAssetId` and a supported cash asset
UUID as `toAssetId`. Select that cash UUID from the catalog using its network
and token. The wallet need not already hold the destination. Preview first.

For the Ethereum example above, submit the following after preview succeeds.
Save a fresh UUID v4 as `REQUEST_ID` and retain the exact request body before sending:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --fail-with-body -sS -X POST "$BASE_URL/v3/wallets/$WALLET_ID/allocate" \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"requestId\":\"$REQUEST_ID\",\"allocations\":[{\"fromAssetId\":\"4ab063cf-303d-4f62-80a6-5a142c1d2fdb\",\"toAssetId\":\"80f900d0-a4b8-4c97-bdc2-8e2ab5228e19\",\"amountUsd\":\"10.000000\"}]}"
```

## 4. Confirm settlement

Track the returned rebalance using the [activity feed](https://docs.groundtech.co/v3/api-reference/list-activity.md) or [Webhooks](https://docs.groundtech.co/v3/docs/portfolio-wallets/webhooks.md). Completion updates the wallet's holdings.

Use source asset UUIDs from the wallet in the environment you are using,
amounts within its available balance, and the documented deposit minimums and
`maxAllocationUsd` from [Get an asset](https://docs.groundtech.co/v3/api-reference/get-asset.md). Choose
destination assets from the catalog or a supported cash route. If preview rejects
a movement, check the source balance, allocation group, and destination eligibility.

## Trade stock tokens

Stock purchases and sales use the same preview and allocation requests above
in a manual wallet (`autoRebalance: false`). To buy, move from a cash asset to
the stock asset; to sell, reverse the direction. Set `stockPriceTolerancePct`
on each stock movement; the default is 1% and the allowed range is 0–5%.
A trade requires a current executable quote.

## Recover an incomplete allocation

Save the request ID and exact payload before submitting. If the request times
out, reuse them unchanged. Read wallet activity before starting another operation.
If the allocation fails, keep its ID and failure reason and contact Ground when
the next action is unclear. An accepted request does not confirm settlement.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.