Create Address Book Entry
curl --request POST \
--url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"currency_symbol": "<string>",
"name": "<string>",
"account_identifier": "<string>",
"chain_ids": [
"<string>"
]
}
'import requests
url = "https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book"
payload = {
"address": "<string>",
"currency_symbol": "<string>",
"name": "<string>",
"account_identifier": "<string>",
"chain_ids": ["<string>"]
}
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({
address: '<string>',
currency_symbol: '<string>',
name: '<string>',
account_identifier: '<string>',
chain_ids: ['<string>']
})
};
fetch('https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book', 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.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book",
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' => '<string>',
'currency_symbol' => '<string>',
'name' => '<string>',
'account_identifier' => '<string>',
'chain_ids' => [
'<string>'
]
]),
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://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"currency_symbol\": \"<string>\",\n \"name\": \"<string>\",\n \"account_identifier\": \"<string>\",\n \"chain_ids\": [\n \"<string>\"\n ]\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://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"currency_symbol\": \"<string>\",\n \"name\": \"<string>\",\n \"account_identifier\": \"<string>\",\n \"chain_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book")
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 \"address\": \"<string>\",\n \"currency_symbol\": \"<string>\",\n \"name\": \"<string>\",\n \"account_identifier\": \"<string>\",\n \"chain_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"activity_type": "ACTIVITY_TYPE_GOVERNANCE_VOTE",
"num_approvals_remaining": 123,
"activity_id": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"subcode": "PORTFOLIO_ID_REQUIRED",
"trace_id": "<string>"
}{
"code": "PERMISSION_DENIED",
"message": "<string>",
"subcode": "AUTH_RESOURCE_ACCESS_DENIED",
"trace_id": "<string>"
}{
"code": "RESOURCE_NOT_FOUND",
"message": "<string>",
"subcode": "AUTH_RESOURCE_NOT_FOUND",
"trace_id": "<string>"
}{
"code": "RATE_LIMIT_EXCEEDED",
"message": "<string>",
"subcode": "SERVER_RATE_LIMIT_EXCEEDED",
"trace_id": "<string>"
}{
"code": "INTERNAL_ERROR",
"message": "<string>",
"subcode": "AUTH_AUTHORIZATION_FAILED",
"trace_id": "<string>"
}{
"code": "SERVICE_UNAVAILABLE",
"message": "<string>",
"subcode": "SERVER_MAINTENANCE_MODE_ACTIVE",
"trace_id": "<string>"
}Address Book
Create Address Book Entry
Creates an entry for a portfolio’s trusted addresses.
POST
/
v1
/
portfolios
/
{portfolio_id}
/
address_book
Create Address Book Entry
curl --request POST \
--url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"currency_symbol": "<string>",
"name": "<string>",
"account_identifier": "<string>",
"chain_ids": [
"<string>"
]
}
'import requests
url = "https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book"
payload = {
"address": "<string>",
"currency_symbol": "<string>",
"name": "<string>",
"account_identifier": "<string>",
"chain_ids": ["<string>"]
}
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({
address: '<string>',
currency_symbol: '<string>',
name: '<string>',
account_identifier: '<string>',
chain_ids: ['<string>']
})
};
fetch('https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book', 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.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book",
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' => '<string>',
'currency_symbol' => '<string>',
'name' => '<string>',
'account_identifier' => '<string>',
'chain_ids' => [
'<string>'
]
]),
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://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"currency_symbol\": \"<string>\",\n \"name\": \"<string>\",\n \"account_identifier\": \"<string>\",\n \"chain_ids\": [\n \"<string>\"\n ]\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://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"currency_symbol\": \"<string>\",\n \"name\": \"<string>\",\n \"account_identifier\": \"<string>\",\n \"chain_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}/address_book")
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 \"address\": \"<string>\",\n \"currency_symbol\": \"<string>\",\n \"name\": \"<string>\",\n \"account_identifier\": \"<string>\",\n \"chain_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"activity_type": "ACTIVITY_TYPE_GOVERNANCE_VOTE",
"num_approvals_remaining": 123,
"activity_id": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"subcode": "PORTFOLIO_ID_REQUIRED",
"trace_id": "<string>"
}{
"code": "PERMISSION_DENIED",
"message": "<string>",
"subcode": "AUTH_RESOURCE_ACCESS_DENIED",
"trace_id": "<string>"
}{
"code": "RESOURCE_NOT_FOUND",
"message": "<string>",
"subcode": "AUTH_RESOURCE_NOT_FOUND",
"trace_id": "<string>"
}{
"code": "RATE_LIMIT_EXCEEDED",
"message": "<string>",
"subcode": "SERVER_RATE_LIMIT_EXCEEDED",
"trace_id": "<string>"
}{
"code": "INTERNAL_ERROR",
"message": "<string>",
"subcode": "AUTH_AUTHORIZATION_FAILED",
"trace_id": "<string>"
}{
"code": "SERVICE_UNAVAILABLE",
"message": "<string>",
"subcode": "SERVER_MAINTENANCE_MODE_ACTIVE",
"trace_id": "<string>"
}Use the Prime SDK or CLI to test this endpoint by following the quickstart guide and running with the following examples
For more information, please visit the Prime Java SDK.For more information, please visit the Prime .NET SDK.For more information, please visit the Prime Go SDK.For more information, please visit the Prime Python SDK.For more information, please visit the Prime CLI.For more information, please visit the Prime TS SDK.
- Java
- .NET
- Go
- Python
- CLI
- TS/JS
AddressBookService addressBookService = PrimeServiceFactory.createAddressBookService(client);
CreateAddressBookEntryRequest request = new CreateAddressBookEntryRequest.Builder("portfolio_id")
.accountIdentifier("account_identifier")
.address("address")
.currencySymbol("currency_symbol")
.name("name")
.build();
CreateAddressBookEntryResponse response = addressBookService.createAddressBookEntry(request);
var addressBookService = new AddressBookService(client);
var request = new CreateAddressBookEntryRequest("portfolio_id")
{
Address = "address",
CurrencySymbol = "currency_symbol",
Name = "name",
AccountIdentifier = "account_identifier",
};
var response = addressBookService.CreateAddressBookEntry(request);
addressBookService := addressbook.NewAddressBookService(client)
request := &addressbook.CreateAddressBookEntryRequest{
PortfolioId: "portfolio-id",
Address: "address",
Symbol: "currency_symbol",
Name: "name",
AccountIdentifier: "account_identifier",
}
response, err := addressBookService.CreateAddressBookEntry(context.Background(), request)
prime_client = PrimeClient(credentials)
request = CreateAddressBookEntryRequest(
portfolio_id="portfolio_id",
address="address",
currency_symbol="currency_symbol",
name="name",
account_identifier="account_identifier",
)
response = prime_client.get_address_book(request)
primectl create-address-book-entry --help
const addressBooksService = new AddressBooksService(client);
addressBooksService.createAddressBook({
portfolioId: 'PORTFOLIO_ID_HERE',
address: 'ADDRESS_HERE',
currencySymbol: 'ETH',
name: 'XYZ Address',
}).then(async (response) => {
console.log('Address Book: ', response);
})
Path Parameters
Portfolio ID
Body
application/json
Response
A successful response.
Available options:
ACTIVITY_TYPE_GOVERNANCE_VOTE, ACTIVITY_TYPE_INVITATION, ACTIVITY_TYPE_WALLET_CHANGE, ACTIVITY_TYPE_API_KEY_CHANGE, ACTIVITY_TYPE_SETTINGS_CHANGE, ACTIVITY_TYPE_BILLING_PREFERENCE_CHANGE, ACTIVITY_TYPE_PAYMENT_METHOD_CHANGE, ACTIVITY_TYPE_WITHDRAWAL, ACTIVITY_TYPE_DEPOSIT, ACTIVITY_TYPE_CREATE_WALLET, ACTIVITY_TYPE_REMOVE_WALLET, ACTIVITY_TYPE_UPDATE_WALLET, ACTIVITY_TYPE_CAST_VOTE, ACTIVITY_TYPE_ENABLE_VOTING, ACTIVITY_TYPE_STAKE, ACTIVITY_TYPE_UNSTAKE, ACTIVITY_TYPE_CHANGE_VALIDATOR, ACTIVITY_TYPE_RESTAKE, ACTIVITY_TYPE_ADDRESS_BOOK, ACTIVITY_TYPE_TEAM_MEMBERS, ACTIVITY_TYPE_BILLING, ACTIVITY_TYPE_SECURITY, ACTIVITY_TYPE_API, ACTIVITY_TYPE_SETTINGS, ACTIVITY_TYPE_SMART_CONTRACT, ACTIVITY_TYPE_USER_CHANGE_REQUEST_NO_PAS, ACTIVITY_TYPE_WEB3_TRANSACTION, ACTIVITY_TYPE_WEB3_MESSAGE, ACTIVITY_TYPE_CLAIM_REWARDS Was this page helpful?