curl --request GET \
--url https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time \
--header 'x-api-key: <api-key>'import requests
url = "https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time"
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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time', 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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time",
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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time"
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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time")
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{
"alert_settings": {
"alert_enabled": true,
"critical": {
"condition": "above",
"threshold": "<string>"
},
"info": {
"condition": "above",
"threshold": "<string>"
},
"warning": {
"condition": "above",
"threshold": "<string>"
}
},
"alert_state": "ok",
"auto_topup": {
"amount": 123,
"cooldown": "3600000000000",
"enabled": true,
"invoicing": true,
"threshold": 123
},
"balance": "<string>",
"balance_updated_at": "2023-11-07T05:31:56Z",
"config": {
"allowed_price_types": [
"ALL"
]
},
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_balance": "<string>",
"credits_available_breakdown": {
"free": "<string>",
"purchased": "<string>"
},
"currency": "<string>",
"current_period_usage": "<string>",
"customer_id": "<string>",
"description": "<string>",
"environment_id": "<string>",
"id": "<string>",
"is_cached_fallback": true,
"metadata": {},
"name": "<string>",
"real_time_balance": "<string>",
"real_time_credit_balance": "<string>",
"status": "published",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"unpaid_invoices_amount": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"wallet_status": "active",
"wallet_type": "PRE_PAID"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Get wallet balance
Use when displaying or checking current wallet balance (e.g. before charging or in a portal). Supports optional expand for credits breakdown and from_cache.
curl --request GET \
--url https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time \
--header 'x-api-key: <api-key>'import requests
url = "https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time"
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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time', 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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time",
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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time"
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://us.api.flexprice.io/v1/wallets/{id}/balance/real-time")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time")
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{
"alert_settings": {
"alert_enabled": true,
"critical": {
"condition": "above",
"threshold": "<string>"
},
"info": {
"condition": "above",
"threshold": "<string>"
},
"warning": {
"condition": "above",
"threshold": "<string>"
}
},
"alert_state": "ok",
"auto_topup": {
"amount": 123,
"cooldown": "3600000000000",
"enabled": true,
"invoicing": true,
"threshold": 123
},
"balance": "<string>",
"balance_updated_at": "2023-11-07T05:31:56Z",
"config": {
"allowed_price_types": [
"ALL"
]
},
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_balance": "<string>",
"credits_available_breakdown": {
"free": "<string>",
"purchased": "<string>"
},
"currency": "<string>",
"current_period_usage": "<string>",
"customer_id": "<string>",
"description": "<string>",
"environment_id": "<string>",
"id": "<string>",
"is_cached_fallback": true,
"metadata": {},
"name": "<string>",
"real_time_balance": "<string>",
"real_time_credit_balance": "<string>",
"status": "published",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"unpaid_invoices_amount": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"wallet_status": "active",
"wallet_type": "PRE_PAID"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Path Parameters
Wallet ID
Query Parameters
Expand fields (e.g., credits_available_breakdown)
Response
OK
Show child attributes
Show child attributes
ok, info, warning, in_alarm Show child attributes
Show child attributes
Show child attributes
Show child attributes
amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits
Show child attributes
Show child attributes
IsCachedFallback is true whenever the response is sourced from cache: either an explicit cache request, or fallback after a real-time failure. Clients should treat the absence of this field as if it were true and only trust freshness when the server explicitly emits false.
Show child attributes
Show child attributes
published, deleted, archived topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
active, frozen, closed PRE_PAID, POST_PAID 
