Skip to main content
POST
/
v2
/
solana
/
accounts
/
{address}
/
export
Export Solana account
curl --request POST \
  --url https://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Wallet-Auth: <x-wallet-auth>' \
  --data '
{
  "exportEncryptionKey": "U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4="
}
'
import requests

url = "https://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export"

payload = { "exportEncryptionKey": "U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4=" }
headers = {
"X-Wallet-Auth": "<x-wallet-auth>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'X-Wallet-Auth': '<x-wallet-auth>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({exportEncryptionKey: 'U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4='})
};

fetch('https://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export', 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://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export",
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([
'exportEncryptionKey' => 'U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4='
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Wallet-Auth: <x-wallet-auth>"
],
]);

$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://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export"

payload := strings.NewReader("{\n \"exportEncryptionKey\": \"U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4=\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Wallet-Auth", "<x-wallet-auth>")
req.Header.Add("Authorization", "Bearer <token>")
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://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export")
.header("X-Wallet-Auth", "<x-wallet-auth>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"exportEncryptionKey\": \"U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4=\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cdp.coinbase.com/platform/v2/solana/accounts/{address}/export")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Wallet-Auth"] = '<x-wallet-auth>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"exportEncryptionKey\": \"U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4=\"\n}"

response = http.request(request)
puts response.read_body
{
  "encryptedPrivateKey": "U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4="
}
{
"errorType": "invalid_request",
"errorMessage": "Solana account with the given address not found."
}
{
"errorType": "unauthorized",
"errorMessage": "Wallet authentication error."
}
{
"errorType": "payment_method_required",
"errorMessage": "A valid payment method is required to complete this operation. Please add a payment method to your account at https://portal.cdp.coinbase.com."
}
{
"errorType": "not_found",
"errorMessage": "Solana account with the given address not found."
}
{
"errorType": "idempotency_error",
"errorMessage": "Idempotency key '8e03978e-40d5-43e8-bc93-6894a57f9324' was already used with a different request payload. Please try again with a new idempotency key."
}
{
"errorType": "internal_server_error",
"errorMessage": "An internal server error occurred. Please try again later."
}
{
"errorType": "bad_gateway",
"errorMessage": "Bad gateway. Please try again later."
}
{
"errorType": "service_unavailable",
"errorMessage": "Service unavailable. Please try again later."
}

Authorizations

Authorization
string
header
required

A JWT signed using your CDP API Key Secret, encoded in base64. Refer to the Generate Bearer Token section of our Authentication docs for information on how to generate your Bearer Token.

Headers

X-Wallet-Auth
string
required

A JWT signed using your Wallet Secret, encoded in base64. Refer to the Generate Wallet Token section of our Authentication docs for more details on how to generate your Wallet Token.

X-Idempotency-Key
string

An optional string request header for making requests safely retryable. When included, duplicate requests with the same key will return identical responses. Refer to our Idempotency docs for more information on using idempotency keys.

Required string length: 1 - 128

Path Parameters

address
string
required

The base58 encoded address of the Solana account.

Pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$

Body

application/json
exportEncryptionKey
string
required

The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key.

Example:

"U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4="

Response

Successfully exported Solana account.

encryptedPrivateKey
string
required

The base64-encoded, encrypted private key of the Solana account which is a 32 byte raw private key. The private key is encrypted in transport using the exportEncryptionKey in the request.

Example:

"U2FsdGVkX1+vupppZksvRf5X5YgHq4+da+Q4qf51+Q4="