> For the complete index of the 402pay docs, see [llms.txt](https://developer.402pay.co/llms.txt).

# Retrieve a send context

Get what the dashboard needs to sign a send: each funded address with its balance and nonce, and the fees.

`GET https://dash.402pay.co/api/v1/wallet/send-context`

What the dashboard reads before it signs a send in the browser. Checkout pays every customer to a fresh address, so a wallet's funds sit across many addresses: this lists each one that holds the coin or the network's own coin, with its balance and next nonce, and what the network charges at each speed. Nothing in it can move funds, and the browser checks every address against the recovery phrase before it signs.

It takes a person signed in to the dashboard, like the [send](https://developer.402pay.co/api/wallet/transactions/create.md) it prepares, so an API key gets 403 `session_required`. Balances and nonces come from the network when it's read, less any sends still pending; on a simulated business they come from its own records, and the fees are fixed. Sends are signed on Solana, Polygon and Ethereum. To move Tron and Bitcoin funds for now, restore the recovery phrase in a wallet app.

### Query

- `network` (string, required): One of `polygon`, `ethereum`, `solana`.
- `asset` (string, required): The coin to send, such as `USDC`.
- `to_address` (string, required): The recipient. On Solana, a token send costs more the first time an address receives the coin.

### Fields to know

- `family` (string): `evm` for Polygon and Ethereum, or `solana`. The rest of the object depends on it.
- `addresses` (array): The main address first, then every address holding the coin or the network's own coin. `index` is the address's place in the wallet (0 is the main address), and `balance` and `native_balance` are in the smallest unit of the coin and of the network's own coin: wei, lamports or the token's base units. EVM addresses also carry the next `nonce`, counting transactions still pending.
- `speeds` (array): Slowest first, each with about how many `minutes` it takes. EVM speeds give `max_fee_per_gas` and `max_priority_fee_per_gas` in wei per gas, and Solana speeds give `compute_unit_price` in micro-lamports per compute unit.
- `gas_limits` (object): EVM only: the gas for a transfer of the network's coin, a token transfer, and a token transfer that another of the wallet's addresses submits under an EIP-3009 authorization. `base_fee_per_gas` gives the expected fee, and `l1_fee_reserve` is what a rollup charges per transaction apart from gas, in wei, `"0"` elsewhere.
- `recent_blockhash` (string): Solana only: the blockhash to sign with. The transaction must land by `last_valid_block_height`, so read a fresh context if the send waits. `recipient_token_account_exists` says whether `to_address` already has an account for the token, or is `null` for SOL.

### Errors

- 400 `invalid_request` A parameter is missing, the coin isn't on the network, or sends on the network aren't signed in the browser yet. `field` names it.
- 400 `invalid_address` `to_address` isn't valid for the network.
- 403 `session_required` An API key sent the request. Only a person signed in to the dashboard can send.
- 404 `not_found` Your business has no wallet yet.
- 409 `external_wallet` The wallet keeps its own keys, so its sends happen in its own app.
- 503 `network_unavailable` The network couldn't be reached. Try again in a moment.

Any request can also fail on its key or its body. See [errors](https://developer.402pay.co/api/errors.md).

Request, Browser:

```js
// On a dashboard page, whose session cookie the browser sends.
const response = await fetch("/api/v1/wallet/send-context?network=polygon&asset=USDC&to_address=0x136e44a2738dea5217e8d6745463d2a9a84d1421", {
  headers: {
    "402pay-Business": businessId,
  },
});
const { data } = await response.json();
```

Response, 200 OK:

```json
{
  "data": {
    "kind": "send_context",
    "family": "evm",
    "network": "polygon",
    "asset": "USDC",
    "chain_id": 137,
    "base_fee_per_gas": "857142857143",
    "gas_limits": {
      "native_transfer": "21000",
      "token_transfer": "80000",
      "token_transfer_with_authorization": "100000"
    },
    "l1_fee_reserve": "0",
    "speeds": [
      {
        "speed": "slow",
        "minutes": 3,
        "max_fee_per_gas": "1904761904762",
        "max_priority_fee_per_gas": "190476190476"
      },
      {
        "speed": "standard",
        "minutes": 2,
        "max_fee_per_gas": "3809523809524",
        "max_priority_fee_per_gas": "380952380952"
      },
      {
        "speed": "fast",
        "minutes": 1,
        "max_fee_per_gas": "7619047619048",
        "max_priority_fee_per_gas": "761904761904"
      }
    ],
    "addresses": [
      {
        "address": "0x2A845e4D5e88c78112A719a6B20E71320A88EF86",
        "index": 0,
        "balance": "0",
        "native_balance": "0",
        "nonce": 0
      },
      {
        "address": "0x6F00bCaA08D1A6De8Ce7724dd643823c978bc81F",
        "index": 1,
        "balance": "49000000",
        "native_balance": "0",
        "nonce": 0
      },
      {
        "address": "0xfb8417FbE62ddD1A7992e40Cb42215f02eAd1b37",
        "index": 2,
        "balance": "0",
        "native_balance": "10000000000000000000",
        "nonce": 0
      }
    ]
  }
}
```
