# Estimate Token Transfer Compute Units Solana

This endpoint estimates the number of compute units an SPL token transfer would consume on Solana. The transfer transaction is built and simulated against the node (without being broadcast) and the simulated compute units consumed are returned. If the recipient does not yet have an associated token account for the given token, the estimate includes the cost of creating it. Supports both the classic Token program and Token-2022 via the tokenStandard field. NFTs on Solana are SPL tokens under the regular Token program, so use "TOKEN" for NFT transfers.

- **Endpoint:** `POST https://rest.cryptoapis.io/blockchain-fees/solana/{network}/estimate-token-transfer-compute-units`
- **Authentication:** `x-api-key` header
- **Credits cost:** 120 credits for 1 result by default; per blockchain: Solana: 120
- **Documentation page:** https://developers.cryptoapis.io/v-2.2024-12-12-175/RESTapis/blockchain-fees-solana/estimate-token-transfer-compute-units-solana/post

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `network` | string | yes | Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while a network like "devnet" is a test network. Allowed values: `mainnet`, `devnet`. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |

## Request body (application/json)

```json
{
  "context": "yourExampleString",
  "data": {
    "item": {
      "amount": "1000000",
      "contractAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "recipient": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
      "sender": "5snoUseZG8s8CDFHrXY2ZHaCrJYsW457piktDmhyb5Jd",
      "tokenStandard": "TOKEN"
    }
  }
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |
| `data` | object | yes |  |
| `data.item` | object | yes |  |
| `data.item.amount` | string | yes | The quantity of the SPL token to transfer, expressed in the token's raw base units (the on-chain integer value, before the mint's decimals are applied) — not a SOL/lamport amount. String-encoded non-negative integer. Example: for a token with 6 decimals, 1.5 tokens = "1500000". |
| `data.item.contractAddress` | string | yes | Base58 string representation of the SPL token mint address (the token's on-chain identifier, equivalent to a token contract address on other chains). |
| `data.item.recipient` | string | yes | Base58 string representation of the recipient owner pubkey (the wallet receiving the tokens; its associated token account is derived automatically). |
| `data.item.sender` | string | yes | Base58 string representation of the sender owner pubkey (the fee payer and source wallet of the tokens). |
| `data.item.tokenStandard` | string | yes | The SPL token standard the mint belongs to. Allowed values: "TOKEN" (classic Token program) or "TOKEN-2022". NFTs on Solana are regular Token-program SPL tokens, so use "TOKEN" for NFT transfers. |

## Responses

| Status | Description |
| --- | --- |
| 200 | The request has been successful. |
| 400 | 400 |
| 401 | 401 |
| 402 | 402 |
| 403 | 403 |
| 409 | The data provided seems to be invalid. |
| 415 | The selected Media Type is unavailable. The Content-Type header should be 'application/json'. |
| 422 | Your request body for POST requests must have a structure of { data: { item: [...properties] } } |
| 429 | The request limit has been reached. There can be maximum {requests} requests per {seconds} second(s) made. Please contact our team via email if you need more or upgrade your plan. |
| 500 | An unexpected server error has occurred, we are working to fix this. Please try again later and in case it occurs again please report it to our team via email. |

### Example 200 response

```json
{
  "apiVersion": "2024-12-12",
  "requestId": "601c1710034ed6d407996b30",
  "context": "yourExampleString",
  "data": {
    "item": {
      "computeUnits": 4645
    }
  }
}
```

### 200 response fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `apiVersion` | string | yes | Specifies the version of the API that incorporates this endpoint. |
| `requestId` | string | yes | Defines the ID of the request. The `requestId` is generated by Crypto APIs and it's unique for every request. |
| `context` | string | no | In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. |
| `data` | object | yes |  |
| `data.item` | object | yes |  |
| `data.item.computeUnits` | integer | yes | Amount of the simulated compute units the SPL token transfer would consume. Includes associated-token-account creation cost when the recipient account does not yet exist. |
