# Prepare An SPL Token Transfer From Address Solana

Prepare an unsigned SPL token transfer from an address. Derives the sender and recipient Associated Token Accounts (creating the recipient ATA in-transaction when it does not yet exist), and returns the unsigned transaction serialized to base64 together with the recent blockhash, compute-budget settings and the estimated fee. The amount is in the token's raw base units (scaled by the mint decimals).

- **Endpoint:** `POST https://rest.cryptoapis.io/prepare-transactions/solana/{network}/spl-tokens`
- **Authentication:** `x-api-key` header
- **Credits cost:** 240 credits for 1 result by default; per blockchain: Solana: 240
- **Documentation page:** https://developers.cryptoapis.io/v-2.2024-12-12-175/RESTapis/prepare-transactions-solana/prepare-an-spl-token-transfer-from-address-solana/post

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `network` | string | yes | Represents the name of the blockchain network used; "mainnet" is the live network with actual data while the others are test networks. 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": {
      "fromAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
      "toAddress": "3Nxr6Wj5tK1abRxWzAf3VvJ2SsTf1cW9y5gEwYbNb6vA",
      "tokenContract": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "amount": "1000000",
      "tokenStandard": "TOKEN",
      "feeOptions": {
        "priority": "standard"
      }
    }
  }
}
```

| 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.fromAddress` | string | yes | Sender's Solana wallet address (base58). Owner of the source token account; also the fee payer. |
| `data.item.toAddress` | string | yes | Recipient's Solana wallet address (base58). Its Associated Token Account is derived (and created in-transaction if it does not yet exist). |
| `data.item.tokenContract` | string | yes | The SPL token mint address (base58). |
| `data.item.amount` | string | yes | Amount to send, in the token's raw base units (integer string, scaled by the mint decimals). |
| `data.item.tokenStandard` | string | no | Optional token program - "TOKEN" (classic SPL, default) or "TOKEN-2022" (Token Extensions). |
| `data.item.feeOptions` | object | no | Fee configuration. |
| `data.item.feeOptions.priority` | string | no | Fee priority - slow, standard or fast. Selects the priority fee tier. |

## Responses

| Status | Description |
| --- | --- |
| 201 | The resource has been successfully submitted. |
| 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 201 response

```json
{
  "apiVersion": "2024-12-12",
  "requestId": "601c1710034ed6d407996b30",
  "context": "yourExampleString",
  "data": {
    "item": {
      "sender": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
      "recipient": "3Nxr6Wj5tK1abRxWzAf3VvJ2SsTf1cW9y5gEwYbNb6vA",
      "amount": "1000000",
      "recentBlockhash": "8HWLsJviKujXjg23sm7v5aiaU9gE1QpLAasEUpCuDUBN",
      "lastValidBlockHeight": "463187603",
      "fee": {
        "amount": "7000",
        "unit": "lamports"
      },
      "computeUnitLimit": "25000",
      "computeUnitPrice": "10000",
      "serializedTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAIEfowIh2C/3h3dzzLBfyCbgkLuUqrxMfrNiNDqLG0LBvIjV7d1+yEItK+z/ZXUvIT1uq9WzenyybmZEAeqND/kXwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwZGb+UhFzL/7K26csOb57yM5bvF9xJrLEObOkAAAABsPEd2LGZ7+weJWXmkKYJUWGEjbNW7o2rEg/TnL/pyZQMDAAUCQA0DAAMACQMQJwAAAAAAAAICAAEMAgAAAKCGAQAAAAAA",
      "tokenContract": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "senderTokenAccount": "H8sMJSCQxfKiFTCfDR3DUMLPwcRbM61LGFJ8N4dK3WjS",
      "recipientTokenAccount": "Bqmac8kQe9dHwXFkJnv5KGjJDpvXfP6E1sTdKMv2yJqL",
      "decimals": 6,
      "tokenStandard": "TOKEN",
      "recipientTokenAccountCreated": false
    }
  }
}
```

### 201 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.sender` | string | yes | The sender (fee payer) wallet address. |
| `data.item.recipient` | string | yes | The recipient wallet address. |
| `data.item.amount` | string | yes | The transferred amount in the token's raw base units. |
| `data.item.recentBlockhash` | string | yes | The recent blockhash the transaction is bound to (~60s TTL). |
| `data.item.lastValidBlockHeight` | string | yes | The last block height at which the blockhash is still valid. |
| `data.item.fee` | object | yes | The estimated transaction fee. |
| `data.item.fee.amount` | string | yes | The fee amount, in the base denomination. |
| `data.item.fee.unit` | string | yes | The fee denomination (lamports). |
| `data.item.computeUnitLimit` | string | yes | The compute unit limit set on the transaction (ComputeBudget). |
| `data.item.computeUnitPrice` | string | yes | The compute unit price in micro-lamports per compute unit (ComputeBudget). |
| `data.item.serializedTransaction` | string | yes | The unsigned transaction, serialized to base64, ready for the signer. |
| `data.item.tokenContract` | string | yes | The SPL token mint address. |
| `data.item.senderTokenAccount` | string | yes | The sender's derived Associated Token Account (source). |
| `data.item.recipientTokenAccount` | string | yes | The recipient's derived Associated Token Account (destination). |
| `data.item.decimals` | integer | yes | The token mint decimals used to scale the amount. |
| `data.item.tokenStandard` | string | yes | The token program used - "TOKEN" or "TOKEN-2022". |
| `data.item.recipientTokenAccountCreated` | boolean | yes | True when the recipient's ATA did not exist and a create-ATA instruction was prepended to the transaction. |
