Get balance
Copy page
Current account balance.
GET /api/v1/user/balance · Permission: balance.read
Request
Section titled “Request”curl https://restlink23telecom.com/api/v1/user/balance \ -H "X-API-Key: $API_KEY"const res = await fetch('https://restlink23telecom.com/api/v1/user/balance', { method: 'GET', headers: { 'X-API-Key': process.env.API_KEY },});
if (!res.ok) { const err = await res.json(); throw new Error(`${err.error_code}: ${err.description}`);}const data = await res.json();console.log(data);import osimport requests
res = requests.get( "https://restlink23telecom.com/api/v1/user/balance", headers={"X-API-Key": os.environ["API_KEY"]},)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://restlink23telecom.com/api/v1/user/balance');curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('API_KEY')],]);
$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);curl_close($ch);
if ($status !== 200) { throw new Exception("HTTP $status: $response");}$data = json_decode($response, true);print_r($data);require "net/http"require "json"
uri = URI("https://restlink23telecom.com/api/v1/user/balance")req = Net::HTTP::Get.new(uri)req["X-API-Key"] = ENV.fetch("API_KEY")
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }raise "HTTP #{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
puts JSON.parse(res.body)import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://restlink23telecom.com/api/v1/user/balance")) .header("X-API-Key", System.getenv("API_KEY")) .GET() .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());package main
import ( "fmt" "io" "net/http" "os")
func main() { req, err := http.NewRequest("GET", "https://restlink23telecom.com/api/v1/user/balance", nil) if err != nil { panic(err) } req.Header.Set("X-API-Key", os.Getenv("API_KEY"))
res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close()
data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();client.DefaultRequestHeaders.Add("X-API-Key", Environment.GetEnvironmentVariable("API_KEY"));
var response = await client.GetAsync("https://restlink23telecom.com/api/v1/user/balance");
response.EnsureSuccessStatusCode();Console.WriteLine(await response.Content.ReadAsStringAsync());Response
Section titled “Response”{ "balance": 1250.50, "currency": "EUR", "updated": "2026.02.13 10:15:00", "credit_limit": 0, "available_balance": 1250.50}available_balance is balance + credit_limit — the actual amount you can
spend. Accounts without a credit line have credit_limit: 0, so
available_balance equals balance.
When available_balance drops to zero or below, the response additionally
contains "credit_blocked": true. Treat this as an account-funding warning.
It is gated on available_balance, not on balance — a credit account with a
negative balance that is still within its credit_limit is not flagged.
Balance and send acceptance
Section titled “Balance and send acceptance”New processing on the current send endpoints does not create a
send-time 402. It accepts and queues direct API traffic fail-open when Portal’s
local balance or pricing data is unavailable. This keeps transactional traffic
moving, but it does not guarantee that the upstream account has enough credit.
Monitor available_balance and credit_blocked before large campaigns. For an
accepted message, use its later delivery report as the source of truth for final
status and cost; do not retry an accepted message_id merely because the local
cost is 0 or the balance cache is degraded.
Degraded state
Section titled “Degraded state”Balance and pricing are served from a background-refreshed cache. If the cache is unavailable, the API still returns HTTP 200 but flags degradation via response headers:
| Header | Values | Meaning |
|---|---|---|
X-Sms-Gateway-Status |
partial, unavailable |
Data quality indicator |
X-Sms-Gateway-Reason |
cache_disabled, cache_miss_refresh_failed |
Machine-readable reason |
These headers are absent on healthy responses. Degraded balance responses
look like {"balance": 0, "currency": "", "unavailable": true, "reason": "…"} —
check the unavailable flag before alerting on a zero balance. Never infer a
currency from a degraded response.
Errors
Section titled “Errors”| Status | error_code |
When |
|---|---|---|
| 403 | FORBIDDEN |
An API key lacks balance.read. Only this case carries required_permission; enable it in Portal → API Keys. |
| 403 | FORBIDDEN |
An Integration SMS key can call only the integration send endpoint; no required_permission is included. |
| 403 | SECTION_ACCESS_DENIED |
A team member (portal session or a key they created) whose role hides Balance & prices or lacks balance.read; the body carries "section": "balance_prices". Owners never receive this error. |
| 403 | API_KEY_CREATOR_INACTIVE |
The key’s creator is no longer active. |
| 429 | RATE_LIMIT_EXCEEDED |
The account’s request rate limit is exceeded (shared by API keys and portal sessions). Retry-After is 1 and X-RateLimit-Limit/X-RateLimit-Burst give the applied limit; a suspended account or team member gets Retry-After: 60 and zero limits. |
| 429 | TOO_MANY_ATTEMPTS |
Too many failed API-key checks from one IP; wait for Retry-After seconds. No X-RateLimit-* headers. |
| 503 | API_KEY_VALIDATION_UNAVAILABLE, AUTH_PROTECTION_UNAVAILABLE, RATE_LIMIT_UNAVAILABLE, SECTION_ACCESS_UNAVAILABLE, WORKSPACE_ACCESS_UNAVAILABLE |
A check before the handler is briefly unavailable; retry. See Temporary errors. |
Portal sessions can also receive CROSS_TENANT_WORKSPACE, NO_ACCESSIBLE_WORKSPACE or NO_MAIN_WORKSPACE; see Errors.
Monitoring recommendation
Section titled “Monitoring recommendation”Poll balance once every few minutes at most (the cache refreshes on its own
cadence), alert on credit_blocked: true, and ignore zero-balance readings
that carry the unavailable: true flag.
