curl --request GET \
--url https://drb.coinbase.com/api/v2/private/get_subaccounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": 4947,
"jsonrpc": "2.0",
"method": "private/get_subaccounts",
"params": {
"with_portfolio": true
}
}
'import requests
url = "https://drb.coinbase.com/api/v2/private/get_subaccounts"
payload = {
"id": 4947,
"jsonrpc": "2.0",
"method": "private/get_subaccounts",
"params": { "with_portfolio": True }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 4947,
jsonrpc: '2.0',
method: 'private/get_subaccounts',
params: {with_portfolio: true}
})
};
fetch('https://drb.coinbase.com/api/v2/private/get_subaccounts', 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://drb.coinbase.com/api/v2/private/get_subaccounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'id' => 4947,
'jsonrpc' => '2.0',
'method' => 'private/get_subaccounts',
'params' => [
'with_portfolio' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://drb.coinbase.com/api/v2/private/get_subaccounts"
payload := strings.NewReader("{\n \"id\": 4947,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_subaccounts\",\n \"params\": {\n \"with_portfolio\": true\n }\n}")
req, _ := http.NewRequest("GET", url, payload)
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.get("https://drb.coinbase.com/api/v2/private/get_subaccounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 4947,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_subaccounts\",\n \"params\": {\n \"with_portfolio\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/private/get_subaccounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 4947,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_subaccounts\",\n \"params\": {\n \"with_portfolio\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 4947,
"jsonrpc": "2.0",
"result": [
{
"email": "user_AAA@email.com",
"id": 2,
"is_password": true,
"login_enabled": true,
"margin_model": "segregated_sm",
"portfolio": {
"btc": {
"additional_reserve": 0,
"available_funds": 5.000413075,
"available_withdrawal_funds": 5.000413075,
"balance": 5.000593987,
"currency": "btc",
"equity": 5.000571846,
"initial_margin": 0.000158771,
"maintenance_margin": 0.000115715,
"margin_balance": 5.000571846,
"spot_reserve": 0
},
"eth": {
"additional_reserve": 0,
"available_funds": 5,
"available_withdrawal_funds": 5,
"balance": 5,
"currency": "eth",
"equity": 5,
"initial_margin": 0,
"maintenance_margin": 0,
"margin_balance": 5,
"spot_reserve": 0
}
},
"receive_notifications": false,
"security_keys_assignments": [],
"security_keys_enabled": false,
"system_name": "user_1",
"type": "main",
"username": "user_1"
},
{
"email": "user_AAA@gmail.com",
"id": 7,
"is_password": true,
"login_enabled": false,
"margin_model": "cross_pm",
"portfolio": {
"btc": {
"additional_reserve": 0,
"available_funds": 0,
"available_withdrawal_funds": 0,
"balance": 0,
"currency": "btc",
"equity": 0,
"initial_margin": 0,
"maintenance_margin": 0,
"margin_balance": 0,
"spot_reserve": 0
},
"eth": {
"additional_reserve": 0,
"available_funds": 0,
"available_withdrawal_funds": 0,
"balance": 0,
"currency": "eth",
"equity": 0,
"initial_margin": 0,
"maintenance_margin": 0,
"margin_balance": 0,
"spot_reserve": 0
}
},
"receive_notifications": false,
"security_keys_assignments": [],
"security_keys_enabled": false,
"system_name": "user_1_1",
"type": "subaccount",
"username": "user_1_1"
}
]
}{
"error": 123,
"jsonrpc": "2.0",
"message": "<string>",
"id": 123
}private/get_subaccounts
Retrieves information about all subaccounts associated with the main account. Returns details such as subaccount IDs, names, and status.
When called from a subaccount, the response includes limited details for the main account and full details for the subaccount initiating the request.
Set the with_portfolio parameter to true to include portfolio information (balances, positions, etc.) in the response. By default, only subaccount metadata is returned.
📖 Related Article: Managing Subaccounts
curl --request GET \
--url https://drb.coinbase.com/api/v2/private/get_subaccounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": 4947,
"jsonrpc": "2.0",
"method": "private/get_subaccounts",
"params": {
"with_portfolio": true
}
}
'import requests
url = "https://drb.coinbase.com/api/v2/private/get_subaccounts"
payload = {
"id": 4947,
"jsonrpc": "2.0",
"method": "private/get_subaccounts",
"params": { "with_portfolio": True }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 4947,
jsonrpc: '2.0',
method: 'private/get_subaccounts',
params: {with_portfolio: true}
})
};
fetch('https://drb.coinbase.com/api/v2/private/get_subaccounts', 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://drb.coinbase.com/api/v2/private/get_subaccounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'id' => 4947,
'jsonrpc' => '2.0',
'method' => 'private/get_subaccounts',
'params' => [
'with_portfolio' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://drb.coinbase.com/api/v2/private/get_subaccounts"
payload := strings.NewReader("{\n \"id\": 4947,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_subaccounts\",\n \"params\": {\n \"with_portfolio\": true\n }\n}")
req, _ := http.NewRequest("GET", url, payload)
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.get("https://drb.coinbase.com/api/v2/private/get_subaccounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 4947,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_subaccounts\",\n \"params\": {\n \"with_portfolio\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://drb.coinbase.com/api/v2/private/get_subaccounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 4947,\n \"jsonrpc\": \"2.0\",\n \"method\": \"private/get_subaccounts\",\n \"params\": {\n \"with_portfolio\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 4947,
"jsonrpc": "2.0",
"result": [
{
"email": "user_AAA@email.com",
"id": 2,
"is_password": true,
"login_enabled": true,
"margin_model": "segregated_sm",
"portfolio": {
"btc": {
"additional_reserve": 0,
"available_funds": 5.000413075,
"available_withdrawal_funds": 5.000413075,
"balance": 5.000593987,
"currency": "btc",
"equity": 5.000571846,
"initial_margin": 0.000158771,
"maintenance_margin": 0.000115715,
"margin_balance": 5.000571846,
"spot_reserve": 0
},
"eth": {
"additional_reserve": 0,
"available_funds": 5,
"available_withdrawal_funds": 5,
"balance": 5,
"currency": "eth",
"equity": 5,
"initial_margin": 0,
"maintenance_margin": 0,
"margin_balance": 5,
"spot_reserve": 0
}
},
"receive_notifications": false,
"security_keys_assignments": [],
"security_keys_enabled": false,
"system_name": "user_1",
"type": "main",
"username": "user_1"
},
{
"email": "user_AAA@gmail.com",
"id": 7,
"is_password": true,
"login_enabled": false,
"margin_model": "cross_pm",
"portfolio": {
"btc": {
"additional_reserve": 0,
"available_funds": 0,
"available_withdrawal_funds": 0,
"balance": 0,
"currency": "btc",
"equity": 0,
"initial_margin": 0,
"maintenance_margin": 0,
"margin_balance": 0,
"spot_reserve": 0
},
"eth": {
"additional_reserve": 0,
"available_funds": 0,
"available_withdrawal_funds": 0,
"balance": 0,
"currency": "eth",
"equity": 0,
"initial_margin": 0,
"maintenance_margin": 0,
"margin_balance": 0,
"spot_reserve": 0
}
},
"receive_notifications": false,
"security_keys_assignments": [],
"security_keys_enabled": false,
"system_name": "user_1_1",
"type": "subaccount",
"username": "user_1_1"
}
]
}{
"error": 123,
"jsonrpc": "2.0",
"message": "<string>",
"id": 123
}Authorizations
Call public/auth with grant_type: coinbase_cdp and a CDP JWT. Send the returned access_token as Authorization: Bearer.
Query Parameters
Portfolio flag: true for portfolio information, false for subaccount information only. false by default
true
If true, includes hidden managed isolated-margin subaccounts in the response. Isolated subaccount entries include isolated: true and isolated_margin_instrument. Default - false
Was this page helpful?