curl --request POST \
--url https://api.coinstats.app/v1/portfolio/exchange \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"connectionId": "binance",
"connectionFields": {
"apiKey": "<your-exchange-api-key>",
"apiSecret": "<your-exchange-api-secret>"
},
"name": "My Binance Portfolio"
}
'import requests
url = "https://api.coinstats.app/v1/portfolio/exchange"
payload = {
"connectionId": "binance",
"connectionFields": {
"apiKey": "<your-exchange-api-key>",
"apiSecret": "<your-exchange-api-secret>"
},
"name": "My Binance Portfolio"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
connectionId: 'binance',
connectionFields: {apiKey: '<your-exchange-api-key>', apiSecret: '<your-exchange-api-secret>'},
name: 'My Binance Portfolio'
})
};
fetch('https://api.coinstats.app/v1/portfolio/exchange', 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/exchange",
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([
'connectionId' => 'binance',
'connectionFields' => [
'apiKey' => '<your-exchange-api-key>',
'apiSecret' => '<your-exchange-api-secret>'
],
'name' => 'My Binance Portfolio'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coinstats.app/v1/portfolio/exchange"
payload := strings.NewReader("{\n \"connectionId\": \"binance\",\n \"connectionFields\": {\n \"apiKey\": \"<your-exchange-api-key>\",\n \"apiSecret\": \"<your-exchange-api-secret>\"\n },\n \"name\": \"My Binance Portfolio\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.coinstats.app/v1/portfolio/exchange")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"connectionId\": \"binance\",\n \"connectionFields\": {\n \"apiKey\": \"<your-exchange-api-key>\",\n \"apiSecret\": \"<your-exchange-api-secret>\"\n },\n \"name\": \"My Binance Portfolio\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coinstats.app/v1/portfolio/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"connectionId\": \"binance\",\n \"connectionFields\": {\n \"apiKey\": \"<your-exchange-api-key>\",\n \"apiSecret\": \"<your-exchange-api-secret>\"\n },\n \"name\": \"My Binance Portfolio\"\n}"
response = http.request(request)
puts response.read_body{
"portfolioId": "a1b2c3d4e5f6...",
"connectionId": "ethereum",
"status": "connected"
}{
"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"
}Connect Portfolio Exchange
Connect an exchange account to your account and create a tracked portfolio
curl --request POST \
--url https://api.coinstats.app/v1/portfolio/exchange \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"connectionId": "binance",
"connectionFields": {
"apiKey": "<your-exchange-api-key>",
"apiSecret": "<your-exchange-api-secret>"
},
"name": "My Binance Portfolio"
}
'import requests
url = "https://api.coinstats.app/v1/portfolio/exchange"
payload = {
"connectionId": "binance",
"connectionFields": {
"apiKey": "<your-exchange-api-key>",
"apiSecret": "<your-exchange-api-secret>"
},
"name": "My Binance Portfolio"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
connectionId: 'binance',
connectionFields: {apiKey: '<your-exchange-api-key>', apiSecret: '<your-exchange-api-secret>'},
name: 'My Binance Portfolio'
})
};
fetch('https://api.coinstats.app/v1/portfolio/exchange', 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/exchange",
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([
'connectionId' => 'binance',
'connectionFields' => [
'apiKey' => '<your-exchange-api-key>',
'apiSecret' => '<your-exchange-api-secret>'
],
'name' => 'My Binance Portfolio'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coinstats.app/v1/portfolio/exchange"
payload := strings.NewReader("{\n \"connectionId\": \"binance\",\n \"connectionFields\": {\n \"apiKey\": \"<your-exchange-api-key>\",\n \"apiSecret\": \"<your-exchange-api-secret>\"\n },\n \"name\": \"My Binance Portfolio\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.coinstats.app/v1/portfolio/exchange")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"connectionId\": \"binance\",\n \"connectionFields\": {\n \"apiKey\": \"<your-exchange-api-key>\",\n \"apiSecret\": \"<your-exchange-api-secret>\"\n },\n \"name\": \"My Binance Portfolio\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coinstats.app/v1/portfolio/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"connectionId\": \"binance\",\n \"connectionFields\": {\n \"apiKey\": \"<your-exchange-api-key>\",\n \"apiSecret\": \"<your-exchange-api-secret>\"\n },\n \"name\": \"My Binance Portfolio\"\n}"
response = http.request(request)
puts response.read_body{
"portfolioId": "a1b2c3d4e5f6...",
"connectionId": "ethereum",
"status": "connected"
}{
"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
- A portfolioId you can use to query portfolio data (value, coins, chart, transactions, defi, snapshot)
- Automatic portfolio creation with visibility set to API
Required
Required
- connectionId: Exchange identifier (e.g., “binance”). Use GET /exchange/support for supported exchanges.
- connectionFields: Exchange API credentials (apiKey, apiSecret, etc.)
Optional
Optional
- name: Custom display name for the portfolio
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.
Body
The connectionId for the cryptocurrency exchange platform. Use GET /exchange/support to get the list of supported exchanges.
"binance"
Authentication credentials required to connect to the exchange. This object should contain the fields specified in GET /exchange/support for the given exchange.
Show child attributes
Show child attributes
{
"apiKey": "<your-exchange-api-key>",
"apiSecret": "<your-exchange-api-secret>"
}
Optional display name for the portfolio.
"My Binance Portfolio"
Response
Connect Exchange Portfolio
The unique identifier of the connected portfolio.
"a1b2c3d4e5f6..."
The connectionId used to connect the portfolio.
"ethereum"
"connected" if a new portfolio was created, "existing" if the portfolio already exists.
connected, existing "connected"
Was this page helpful?