curl --request POST \
--url https://payments.magicblock.app/v1/spl/transfer \
--header 'Content-Type: application/json' \
--data '
{
"from": "3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE",
"to": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L",
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 1000000,
"visibility": "private",
"fromBalance": "base",
"toBalance": "base",
"initIfMissing": true,
"initAtasIfMissing": true,
"initVaultIfMissing": true,
"memo": "Order #1042",
"minDelayMs": "0",
"maxDelayMs": "0",
"split": 1
}
'import requests
url = "https://payments.magicblock.app/v1/spl/transfer"
payload = {
"from": "3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE",
"to": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L",
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 1000000,
"visibility": "private",
"fromBalance": "base",
"toBalance": "base",
"initIfMissing": True,
"initAtasIfMissing": True,
"initVaultIfMissing": True,
"memo": "Order #1042",
"minDelayMs": "0",
"maxDelayMs": "0",
"split": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
from: '3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE',
to: 'Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L',
mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: 1000000,
visibility: 'private',
fromBalance: 'base',
toBalance: 'base',
initIfMissing: true,
initAtasIfMissing: true,
initVaultIfMissing: true,
memo: 'Order #1042',
minDelayMs: '0',
maxDelayMs: '0',
split: 1
})
};
fetch('https://payments.magicblock.app/v1/spl/transfer', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://payments.magicblock.app/v1/spl/transfer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE',
'to' => 'Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L',
'mint' => 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
'amount' => 1000000,
'visibility' => 'private',
'fromBalance' => 'base',
'toBalance' => 'base',
'initIfMissing' => true,
'initAtasIfMissing' => true,
'initVaultIfMissing' => true,
'memo' => 'Order #1042',
'minDelayMs' => '0',
'maxDelayMs' => '0',
'split' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://payments.magicblock.app/v1/spl/transfer"
payload := strings.NewReader("{\n \"from\": \"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE\",\n \"to\": \"Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L\",\n \"mint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 1000000,\n \"visibility\": \"private\",\n \"fromBalance\": \"base\",\n \"toBalance\": \"base\",\n \"initIfMissing\": true,\n \"initAtasIfMissing\": true,\n \"initVaultIfMissing\": true,\n \"memo\": \"Order #1042\",\n \"minDelayMs\": \"0\",\n \"maxDelayMs\": \"0\",\n \"split\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://payments.magicblock.app/v1/spl/transfer")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE\",\n \"to\": \"Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L\",\n \"mint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 1000000,\n \"visibility\": \"private\",\n \"fromBalance\": \"base\",\n \"toBalance\": \"base\",\n \"initIfMissing\": true,\n \"initAtasIfMissing\": true,\n \"initVaultIfMissing\": true,\n \"memo\": \"Order #1042\",\n \"minDelayMs\": \"0\",\n \"maxDelayMs\": \"0\",\n \"split\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.magicblock.app/v1/spl/transfer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE\",\n \"to\": \"Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L\",\n \"mint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 1000000,\n \"visibility\": \"private\",\n \"fromBalance\": \"base\",\n \"toBalance\": \"base\",\n \"initIfMissing\": true,\n \"initAtasIfMissing\": true,\n \"initVaultIfMissing\": true,\n \"memo\": \"Order #1042\",\n \"minDelayMs\": \"0\",\n \"maxDelayMs\": \"0\",\n \"split\": 1\n}"
response = http.request(request)
puts response.read_body{
"kind": "deposit",
"version": "legacy",
"transactionBase64": "<string>",
"sendTo": "base",
"recentBlockhash": "<string>",
"lastValidBlockHeight": 123,
"instructionCount": 1,
"requiredSigners": [
"So11111111111111111111111111111111111111112"
],
"validator": "So11111111111111111111111111111111111111112"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
]
}
}Transfer SPL Tokens
Transfer SPL tokens publicly or privately through an ephemeral rollup.
curl --request POST \
--url https://payments.magicblock.app/v1/spl/transfer \
--header 'Content-Type: application/json' \
--data '
{
"from": "3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE",
"to": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L",
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 1000000,
"visibility": "private",
"fromBalance": "base",
"toBalance": "base",
"initIfMissing": true,
"initAtasIfMissing": true,
"initVaultIfMissing": true,
"memo": "Order #1042",
"minDelayMs": "0",
"maxDelayMs": "0",
"split": 1
}
'import requests
url = "https://payments.magicblock.app/v1/spl/transfer"
payload = {
"from": "3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE",
"to": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L",
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": 1000000,
"visibility": "private",
"fromBalance": "base",
"toBalance": "base",
"initIfMissing": True,
"initAtasIfMissing": True,
"initVaultIfMissing": True,
"memo": "Order #1042",
"minDelayMs": "0",
"maxDelayMs": "0",
"split": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
from: '3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE',
to: 'Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L',
mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: 1000000,
visibility: 'private',
fromBalance: 'base',
toBalance: 'base',
initIfMissing: true,
initAtasIfMissing: true,
initVaultIfMissing: true,
memo: 'Order #1042',
minDelayMs: '0',
maxDelayMs: '0',
split: 1
})
};
fetch('https://payments.magicblock.app/v1/spl/transfer', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://payments.magicblock.app/v1/spl/transfer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE',
'to' => 'Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L',
'mint' => 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
'amount' => 1000000,
'visibility' => 'private',
'fromBalance' => 'base',
'toBalance' => 'base',
'initIfMissing' => true,
'initAtasIfMissing' => true,
'initVaultIfMissing' => true,
'memo' => 'Order #1042',
'minDelayMs' => '0',
'maxDelayMs' => '0',
'split' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://payments.magicblock.app/v1/spl/transfer"
payload := strings.NewReader("{\n \"from\": \"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE\",\n \"to\": \"Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L\",\n \"mint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 1000000,\n \"visibility\": \"private\",\n \"fromBalance\": \"base\",\n \"toBalance\": \"base\",\n \"initIfMissing\": true,\n \"initAtasIfMissing\": true,\n \"initVaultIfMissing\": true,\n \"memo\": \"Order #1042\",\n \"minDelayMs\": \"0\",\n \"maxDelayMs\": \"0\",\n \"split\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://payments.magicblock.app/v1/spl/transfer")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE\",\n \"to\": \"Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L\",\n \"mint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 1000000,\n \"visibility\": \"private\",\n \"fromBalance\": \"base\",\n \"toBalance\": \"base\",\n \"initIfMissing\": true,\n \"initAtasIfMissing\": true,\n \"initVaultIfMissing\": true,\n \"memo\": \"Order #1042\",\n \"minDelayMs\": \"0\",\n \"maxDelayMs\": \"0\",\n \"split\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.magicblock.app/v1/spl/transfer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE\",\n \"to\": \"Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L\",\n \"mint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"amount\": 1000000,\n \"visibility\": \"private\",\n \"fromBalance\": \"base\",\n \"toBalance\": \"base\",\n \"initIfMissing\": true,\n \"initAtasIfMissing\": true,\n \"initVaultIfMissing\": true,\n \"memo\": \"Order #1042\",\n \"minDelayMs\": \"0\",\n \"maxDelayMs\": \"0\",\n \"split\": 1\n}"
response = http.request(request)
puts response.read_body{
"kind": "deposit",
"version": "legacy",
"transactionBase64": "<string>",
"sendTo": "base",
"recentBlockhash": "<string>",
"lastValidBlockHeight": 123,
"instructionCount": 1,
"requiredSigners": [
"So11111111111111111111111111111111111111112"
],
"validator": "So11111111111111111111111111111111111111112"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": [
"<string>"
]
}
]
}
}Body
Transfer request
"So11111111111111111111111111111111111111112"
"So11111111111111111111111111111111111111112"
"So11111111111111111111111111111111111111112"
Base-unit amount as an integer JSON value with minimum 1.
x >= 11000000
public, private base, ephemeral base, ephemeral Optional. Use mainnet for BASE_RPC_URL and EPHEMERAL_RPC_URL, devnet for BASE_DEVNET_RPC_URL and EPHEMERAL_DEVNET_RPC_URL, or provide a custom http(s) RPC URL to override the base RPC while keeping the configured ephemeral RPC.
mainnet, devnet "mainnet"
Optional. When this transfer route needs a validator and none is provided, the API resolves it from the selected ephemeral RPC via getIdentity.
"MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57"
Optional. Appends a final Memo Program instruction with this UTF-8 message.
"Order #1042"
Optional. Private transfer only. Defaults to 0.
^\d+$"0"
Optional. Private transfer only. Defaults to 0 when omitted, or to minDelayMs when minDelayMs is set.
^\d+$"0"
Optional. Private transfer only. Defaults to 1. Must be between 1 and 15.
x <= 151
Response
Unsigned serialized transaction
deposit, withdraw, transfer legacy base, ephemeral x >= 0"So11111111111111111111111111111111111111112"
Was this page helpful?

