curl --request GET \
--url https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance', 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://sandbox-api.polygon.technology/v0.13/customers/{id}/balance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://sandbox-api.polygon.technology/v0.13/customers/{id}/balance"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"customerId": "<string>",
"estimatedBalanceValue": "<string>",
"estimatedBalanceCurrencyCode": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"totalBalance": {
"totalUsd": "<string>",
"fiatUsd": "<string>",
"cryptoUsd": "<string>"
}
}
}{
"error": "InvalidCustomerID",
"code": 10000,
"msg": "invalid customer_id",
"cause": "<string>"
}{
"error": "Unauthorized",
"code": 1000,
"msg": "unauthorized access",
"cause": "<string>"
}{
"error": "CustomerNotFound",
"code": 10001,
"msg": "customer not found",
"cause": "<string>"
}{
"error": "ProviderUserAccountNotFound",
"code": 10029,
"msg": "provider account not provisioned for this customer",
"cause": "<string>"
}{
"error": "Provider",
"code": 10002,
"msg": "invalid provider balance response",
"cause": "<string>"
}{
"error": "ProviderUnreachable",
"code": 10087,
"msg": "upstream provider unreachable",
"cause": "<string>"
}Get customer balance
Get the aggregated estimated balance across all customer wallets/assets.
curl --request GET \
--url https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance', 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://sandbox-api.polygon.technology/v0.13/customers/{id}/balance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://sandbox-api.polygon.technology/v0.13/customers/{id}/balance"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.polygon.technology/v0.13/customers/{id}/balance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"customerId": "<string>",
"estimatedBalanceValue": "<string>",
"estimatedBalanceCurrencyCode": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"totalBalance": {
"totalUsd": "<string>",
"fiatUsd": "<string>",
"cryptoUsd": "<string>"
}
}
}{
"error": "InvalidCustomerID",
"code": 10000,
"msg": "invalid customer_id",
"cause": "<string>"
}{
"error": "Unauthorized",
"code": 1000,
"msg": "unauthorized access",
"cause": "<string>"
}{
"error": "CustomerNotFound",
"code": 10001,
"msg": "customer not found",
"cause": "<string>"
}{
"error": "ProviderUserAccountNotFound",
"code": 10029,
"msg": "provider account not provisioned for this customer",
"cause": "<string>"
}{
"error": "Provider",
"code": 10002,
"msg": "invalid provider balance response",
"cause": "<string>"
}{
"error": "ProviderUnreachable",
"code": 10087,
"msg": "upstream provider unreachable",
"cause": "<string>"
}Authorizations
Token from POST /auth/token
Path Parameters
Customer ID (cst_ prefix).
Query Parameters
ISO 4217 currency for the estimated value. Defaults to USD.
Response
The request has succeeded.
A customer's estimated total balance, aggregated across all of their wallets and assets.
Hide child attributes
Hide child attributes
Public OMS customer ID, format cst_<typeID>.
^[a-z]+_([0-9a-hjkmnp-tv-z]{26}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$Estimated total balance value across all customer wallets/assets, in the currency requested via the estimatedBalanceCurrencyCode query param. Defaults to USD when the query param is omitted. Decimal string.
Currency code used for estimatedBalanceValue.
Most recent provider balance timestamp included in the aggregate. Omitted when no provider balance timestamps were available to aggregate.
USD rollup of the customer's balances — fiat, crypto, and the total. Returned by GET /customers/{id}/balance only when the aggregate is read in USD, so it is omitted whenever estimatedBalanceCurrencyCode names another currency. Also omitted as a whole if either component cannot be read: a partial total is never returned. estimatedBalanceValue above is unaffected and is still returned in the requested currency.
Hide child attributes
Hide child attributes
fiatUsd + cryptoUsd, formatted to 2 decimal places, sign preserved (e.g. "25.00", "-15.50").
Signed sum of the customer's USD fiat wallet balances as last reported by the bank holding them ("Erebor Bank, N.A." today; see provider on the wallet), formatted to 2 decimal places. Can be negative.
Signed sum of the customer's custodial crypto wallet balances, valued at the custodian's own per-asset USD estimate and formatted to 2 decimal places. noncustodial wallets are not valued here. "0.00" for a customer with no custodial crypto account.
Was this page helpful?