Accounts
Create Account
Create a new sub-account with a signer
POST
/
accounts
Create Account
curl --request POST \
--url https://api.example.com/accountsimport requests
url = "https://api.example.com/accounts"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/accounts', 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.example.com/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/accounts"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/accounts")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCreate Account
Creates a new sub-account under your Prime Account. Each sub-account gets its own on-chain wallet (Quark Wallet) on all supported networks.Request
POST /accounts
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
signer_type | string | Yes | Type of signer. Currently supported: "eoa" |
signer_address | string | Yes (for EOA) | Ethereum address of the EOA signer (0x-prefixed, 40 hex chars) |
Examples
curl -X POST https://prime-api.legend.xyz/accounts \
-H "Authorization: Bearer $LEGEND_QUERY_KEY" \
-H "Content-Type: application/json" \
-d '{
"signer_type": "eoa",
"signer_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18"
}'
const account = await client.accounts.create({
signerType: "eoa",
signerAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
});
account = await client.accounts.create(
signer_type="eoa",
signer_address="0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
)
use legend_client::CreateAccountParams;
let account = client.accounts.create(&CreateAccountParams {
signer_type: "eoa".into(),
ethereum_signer_address: Some("0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18".into()),
..Default::default()
}).await?;
Response (201 Created)
{
"account_id": "acc_2o0yiljtp378",
"signer_type": "eoa",
"signer_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
"legend_wallet_address": "0xc40897f38bc3d4e4d17f9daf46d2a13b4c47642f",
"created_at": "2025-06-15T10:30:00Z"
}
Response fields
| Field | Type | Description |
|---|---|---|
account_id | string | Unique identifier for the sub-account (acc_ prefix) |
signer_type | string | Signer type used for this account |
signer_address | string | Ethereum address of the signer |
legend_wallet_address | string | On-chain wallet address (deterministic from the signer) |
created_at | string | ISO 8601 timestamp |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | invalid_params | Invalid signer_type or malformed signer_address |
| 409 | account_already_exists | A sub-account with this signer already exists |
Error example
{
"error": "account_already_exists",
"message": "An account already exists with this configuration"
}
Notes
- The
legend_wallet_addressis deterministic — it’s computed from the signer address using CREATE2. This means you can predict the wallet address before creating the account. - Quark Wallets are created on all supported networks simultaneously.
- The signer’s private key never touches Legend’s servers. You or your end-user retain full custody.
⌘I
Create Account
curl --request POST \
--url https://api.example.com/accountsimport requests
url = "https://api.example.com/accounts"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/accounts', 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.example.com/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/accounts"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/accounts")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body