curl --request GET \
--url https://us.api.flexprice.io/v1/wallets/{id}/balance/real-time \
--header 'x-api-key: <api-key>'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.wallets.get_wallet_balance(id="<id>")
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.wallets.getWalletBalance("<id>");
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Wallets.GetWalletBalance(ctx, "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res.WalletBalanceResponse != nil {
// handle response
}
}{
"alert_settings": {
"alert_enabled": true,
"alert_threshold_type": "absolute",
"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>'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.wallets.get_wallet_balance(id="<id>")
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.wallets.getWalletBalance("<id>");
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Wallets.GetWalletBalance(ctx, "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res.WalletBalanceResponse != nil {
// handle response
}
}{
"alert_settings": {
"alert_enabled": true,
"alert_threshold_type": "absolute",
"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 
