curl "https://api.coinstats.app/v1/portfolio/pl/history?range=1m&interval=daily¤cy=USD" -H "X-API-KEY: <api-key>"import requests
url = "https://api.coinstats.app/v1/portfolio/pl/history"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.coinstats.app/v1/portfolio/pl/history', 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.coinstats.app/v1/portfolio/pl/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$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.coinstats.app/v1/portfolio/pl/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
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.coinstats.app/v1/portfolio/pl/history")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coinstats.app/v1/portfolio/pl/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"result": [
{
"date": "2026-08-24T00:00:00.000Z",
"profitLoss": 123.45,
"profitLossPercent": 1.27
}
],
"meta": {
"currency": "USD",
"range": "1m",
"interval": "daily",
"from": "2026-07-25T00:00:00.000Z",
"to": "2026-08-24T00:00:00.000Z",
"lastSyncedAt": "2026-08-24T12:34:56.000Z"
}
}{
"statusCode": 400,
"message": "Bad Request",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 401,
"message": "Unauthorized",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 403,
"message": "Forbidden",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 404,
"message": "Not Found",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 409,
"message": "Transactions not synced",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 429,
"message": "Rate limit exceeded",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 503,
"message": "Service Unavailable. Please Contact Support"
}Get Portfolio PnL History
Get a cash-flow-adjusted historical portfolio P&L chart
curl "https://api.coinstats.app/v1/portfolio/pl/history?range=1m&interval=daily¤cy=USD" -H "X-API-KEY: <api-key>"import requests
url = "https://api.coinstats.app/v1/portfolio/pl/history"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.coinstats.app/v1/portfolio/pl/history', 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.coinstats.app/v1/portfolio/pl/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$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.coinstats.app/v1/portfolio/pl/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
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.coinstats.app/v1/portfolio/pl/history")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coinstats.app/v1/portfolio/pl/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"result": [
{
"date": "2026-08-24T00:00:00.000Z",
"profitLoss": 123.45,
"profitLossPercent": 1.27
}
],
"meta": {
"currency": "USD",
"range": "1m",
"interval": "daily",
"from": "2026-07-25T00:00:00.000Z",
"to": "2026-08-24T00:00:00.000Z",
"lastSyncedAt": "2026-08-24T12:34:56.000Z"
}
}{
"statusCode": 400,
"message": "Bad Request",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 401,
"message": "Unauthorized",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 403,
"message": "Forbidden",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 404,
"message": "Not Found",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 409,
"message": "Transactions not synced",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 429,
"message": "Rate limit exceeded",
"requestId": "11111111-2222-3333-4444-555555555555",
"path": "<requested-endpoint>"
}{
"statusCode": 503,
"message": "Service Unavailable. Please Contact Support"
}You will get
You will get
- Chronological period P&L and P&L percentage points
- Deposits and withdrawals removed from investment performance
- The effective currency, range, interval, from, and to values
Required
Required
- interval: hourly, daily, weekly, monthly, or yearly
- Exactly one time mode: range, or both from and to
Optional
Optional
- portfolioId: An owned API-connected portfolio; omit it to aggregate all owned API-connected portfolios
- shareToken and passcode: Access a shared CoinStats portfolio instead
- currency: Defaults to USD
Authorizations
API key required to access the endpoints. Generate one from your dashboard at https://openapi.coinstats.app and pass it in the X-API-KEY request header. Never expose your key in client-side code.
Headers
Passcode for accessing protected portfolio data
"123456"
Query Parameters
Preset time range. Mutually exclusive with from/to.
24h, 1w, 1m, 3m, 6m, 1y, all "1m"
Inclusive custom-range start. Use YYYY-MM-DD (UTC midnight) or an ISO timestamp with timezone. Must be provided with to and without range.
"2026-07-25T00:00:00.000Z"
Exclusive custom-range end. Use YYYY-MM-DD (UTC midnight) or an ISO timestamp with timezone. Must be provided with from and without range.
"2026-08-24T00:00:00.000Z"
Chart bucket interval. Hourly is available only for 24h or a custom window of at most 24 hours entirely within the latest 24 hours.
hourly, daily, weekly, monthly, yearly "daily"
Currency for P&L values. Defaults to USD.
"USD"
API-connected portfolio ID. Omit to aggregate all owned API-connected portfolios. Mutually exclusive with shareToken.
"abc123def456"
Was this page helpful?