Initialize import
curl --request POST \
--url https://api.privy.io/v1/wallets/import/init \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"address": "0xF1DBff66C993EE895C8cb176c30b07A559d76496",
"chain_type": "ethereum",
"entropy_type": "private-key",
"encryption_type": "HPKE"
}
'HttpResponse<String> response = Unirest.post("https://api.privy.io/v1/wallets/import/init")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"0xF1DBff66C993EE895C8cb176c30b07A559d76496\",\n \"chain_type\": \"ethereum\",\n \"entropy_type\": \"private-key\",\n \"encryption_type\": \"HPKE\"\n}")
.asString();const options = {
method: 'POST',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
address: '0xF1DBff66C993EE895C8cb176c30b07A559d76496',
chain_type: 'ethereum',
entropy_type: 'private-key',
encryption_type: 'HPKE'
})
};
fetch('https://api.privy.io/v1/wallets/import/init', 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.privy.io/v1/wallets/import/init",
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([
'address' => '0xF1DBff66C993EE895C8cb176c30b07A559d76496',
'chain_type' => 'ethereum',
'entropy_type' => 'private-key',
'encryption_type' => 'HPKE'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"privy-app-id: <privy-app-id>"
],
]);
$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.privy.io/v1/wallets/import/init"
payload := strings.NewReader("{\n \"address\": \"0xF1DBff66C993EE895C8cb176c30b07A559d76496\",\n \"chain_type\": \"ethereum\",\n \"entropy_type\": \"private-key\",\n \"encryption_type\": \"HPKE\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}{
"encryption_type": "HPKE",
"encryption_public_key": "BDAZLOIdTaPycEYkgG0MvCzbIKJLli/yWkAV5yCa9yOsZ4JsrLweA5MnP8YIiY4k/RRzC+APhhO+P+Hoz/rt7Go="
}Import wallet
Initialize import
Initialize a wallet import. Complete by submitting the import.
POST
/
v1
/
wallets
/
import
/
init
Initialize import
curl --request POST \
--url https://api.privy.io/v1/wallets/import/init \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'privy-app-id: <privy-app-id>' \
--data '
{
"address": "0xF1DBff66C993EE895C8cb176c30b07A559d76496",
"chain_type": "ethereum",
"entropy_type": "private-key",
"encryption_type": "HPKE"
}
'HttpResponse<String> response = Unirest.post("https://api.privy.io/v1/wallets/import/init")
.header("privy-app-id", "<privy-app-id>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"0xF1DBff66C993EE895C8cb176c30b07A559d76496\",\n \"chain_type\": \"ethereum\",\n \"entropy_type\": \"private-key\",\n \"encryption_type\": \"HPKE\"\n}")
.asString();const options = {
method: 'POST',
headers: {
'privy-app-id': '<privy-app-id>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
address: '0xF1DBff66C993EE895C8cb176c30b07A559d76496',
chain_type: 'ethereum',
entropy_type: 'private-key',
encryption_type: 'HPKE'
})
};
fetch('https://api.privy.io/v1/wallets/import/init', 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.privy.io/v1/wallets/import/init",
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([
'address' => '0xF1DBff66C993EE895C8cb176c30b07A559d76496',
'chain_type' => 'ethereum',
'entropy_type' => 'private-key',
'encryption_type' => 'HPKE'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"privy-app-id: <privy-app-id>"
],
]);
$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.privy.io/v1/wallets/import/init"
payload := strings.NewReader("{\n \"address\": \"0xF1DBff66C993EE895C8cb176c30b07A559d76496\",\n \"chain_type\": \"ethereum\",\n \"entropy_type\": \"private-key\",\n \"encryption_type\": \"HPKE\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("privy-app-id", "<privy-app-id>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}{
"encryption_type": "HPKE",
"encryption_public_key": "BDAZLOIdTaPycEYkgG0MvCzbIKJLli/yWkAV5yCa9yOsZ4JsrLweA5MnP8YIiY4k/RRzC+APhhO+P+Hoz/rt7Go="
}SDK methods
Learn more about importing wallets using our SDKs here.Idempotency on errors: On 4xx or 5xx, Privy caches the response and replays it for the same
key. Generate a new key to retry after a server error. Policy violations are an exception and
allow same-key retries.
Authorizations
Basic Auth header with your app ID as the username and your app secret as the password.
Headers
ID of your Privy app.
Body
application/json
- HDInitInput
- PrivateKeyInitInput
The input for HD wallets.
The address of the wallet to import.
The chain type of the wallet to import. Supports ethereum, solana, stellar, tron, sui, aptos, and xrpl.
Available options:
ethereum, solana, stellar, tron, sui, aptos, xrpl The encryption type of the wallet to import. Currently only supports HPKE.
Available options:
HPKE The entropy type of the wallet to import.
Available options:
hd The index of the wallet to import.
Required range:
x >= 0Response
200 - application/json
The encryption public key to encrypt the wallet entropy with.
Was this page helpful?

