curl --request GET \
--url https://sandbox-api.polygon.technology/v0.11/customers/{id}/balance \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox-api.polygon.technology/v0.11/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.11/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.11/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.11/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.11/customers/{id}/balance")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.polygon.technology/v0.11/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": "invalid customer id"
}{
"error": "unauthorized"
}{
"error": "customer not found"
}{
"error": "provider account not provisioned for this customer",
"code": "providerUserAccountNotFound"
}{
"error": "<string>",
"code": "providerError"
}{
"error": "upstream provider unreachable",
"code": "providerUnreachable"
}Get customer balance
Get the aggregated estimated balance across all customer wallets/assets.
curl --request GET \
--url https://sandbox-api.polygon.technology/v0.11/customers/{id}/balance \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox-api.polygon.technology/v0.11/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.11/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.11/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.11/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.11/customers/{id}/balance")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.polygon.technology/v0.11/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": "invalid customer id"
}{
"error": "unauthorized"
}{
"error": "customer not found"
}{
"error": "provider account not provisioned for this customer",
"code": "providerUserAccountNotFound"
}{
"error": "<string>",
"code": "providerError"
}{
"error": "upstream provider unreachable",
"code": "providerUnreachable"
}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 balance rollup (fiat / crypto / total) for OMSX to compose
Customer.totalBalance (v0.11-8, #2362). Mirrors the OMS
Customer.totalBalance shape 1:1. Omitted as a whole when the Coinme
provider read (or the fiat mirror read) fails — a partial/half total is
never returned. estimatedBalanceValue above is retained unchanged for
back-compat.
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, read from the
cached Erebor mirror (account_balances, USD 1:1). No Erebor call on the
hot path. Formatted to 2 decimal places, sign preserved.
Signed sum of Coinme custodial crypto balances valued in USD, formatted to
2 decimal places. "0.00" for a customer with no Coinme account.
Was this page helpful?