Get Portfolio by Portfolio ID
curl --request GET \
--url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}import requests
url = "https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.prime.coinbase.com/v1/portfolios/{portfolio_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"portfolio": {
"id": "e8bbed13-fa33-41de-86d5-4335d8f08166",
"name": "CryptoBalances",
"entity_id": "2c521d6c-1cfb-4371-bf9c-5a42938d3e75",
"organization_id": "4c1d4464-e53b-429f-a81d-71ae7e2e687c",
"entity_name": "Sample Prime Entity"
}
}Portfolios
Get Portfolio by Portfolio ID
Retrieve a given portfolio by its portfolio ID.
GET
/
v1
/
portfolios
/
{portfolio_id}
Get Portfolio by Portfolio ID
curl --request GET \
--url https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}import requests
url = "https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.prime.coinbase.com/v1/portfolios/{portfolio_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prime.coinbase.com/v1/portfolios/{portfolio_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"portfolio": {
"id": "e8bbed13-fa33-41de-86d5-4335d8f08166",
"name": "CryptoBalances",
"entity_id": "2c521d6c-1cfb-4371-bf9c-5a42938d3e75",
"organization_id": "4c1d4464-e53b-429f-a81d-71ae7e2e687c",
"entity_name": "Sample Prime Entity"
}
}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
PortfoliosService portfoliosService = PrimeServiceFactory.createPortfoliosService(client);
GetPortfolioByIdRequest request = new GetPortfolioByIdRequest.Builder().portfolioId("PORTFOLIO_ID_HERE").build();
GetPortfolioByIdResponse response = portfoliosService.getPortfolioById(request);
var portfoliosService = new PortfoliosService(client);
var request = new GetPortfolioByIdRequest("PORTFOLIO_ID_HERE");
var response = portfoliosService.GetPortfolioById(request);
portfoliosService := portfolios.NewPortfoliosService(client)
request := &portfolios.GetPortfolio{
PortfolioId: "PORTFOLIO_ID_HERE",
}
response, err := portfoliosService.GetPortfolio(context.Background(), request)
prime_client = PrimeClient(credentials)
request = GetPortfolioRequest(
portfolio_id="PORTFOLIO_ID_HERE",
)
response = prime_client.get_portfolio(request)
primectl get-portfolio --help
const portfoliosService = new PortfoliosService(client);
portfoliosService.getPortfolio({
portfolioId: 'PORTFOLIO_ID_HERE'
}).then(async (response) => {
console.log('Portfolio: ', response);
})
Was this page helpful?
⌘I