Check My Balance
Endpoint:
https://api.betatel.com/api/billing/me/balance
Method: GET
Description: Retrieve the current balance for a specific user.
Request Headers
The request must include an Authorization header with a valid API key for authentication:
Header | Value | Required | Description |
---|---|---|---|
x-api-key | {{x-api-key}} | Yes | The authentication api key to verify the user's identity |
Let’s Dive Into the Code!
Choose your preferred programming language and use the provided examples to integrate the get check user balance.
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
Example - cURL
curl --location 'https://api.betatel.com/api/billing/me/balance' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow' \
--header 'x-api-key: ••••••'
Example - Python
import http.client
conn = http.client.HTTPSConnection("api.betatel.com")
payload = ''
headers = {
'x-api-key': 'C8FdQrQKxXiLvUtEoyLobJopZwZhalPhdoDr9qVxACBI'
}
conn.request("GET", "/api/billing/me/balance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example - Node.js
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.betatel.com/api/billing/me/balance',
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'x-api-key': '••••••'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Example - PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.betatel.com/api/billing/me/balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow',
'x-api-key: ••••••'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example - Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.betatel.com/api/billing/me/balance")
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow")
.header("x-api-key", "••••••")
.asString();
Example - C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.betatel.com/api/billing/me/balance");
request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3ZWE2MjJiMDU1MjkzNWZhYzVjZDFhZCIsImVtYWlsIjoicG92aWQ2ODFAbm9rZG90LmNvbSIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNzQzNDI4Mjk3LCJleHAiOjE3NDM0MzE4OTd9.dS4w_GEw4jVoMm5pvv6uoYnC9TYGO3rAbUeRMxK1iow");
request.Headers.Add("x-api-key", "••••••");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Response
JSON Schema:
{
"userId": "user123",
"balance": 245.65,
"currency": "USD",
"lastUpdated": "2025-03-18T14:32:05Z"
}
Field | Type | Description |
---|---|---|
userId | string | The unique identifier for the user (e.g., "user123"). |
balance | number | The current balance of the user (e.g., 245.65). |
currency | string | The currency in which the balance is represented (e.g., "USD"). |
lastUpdated | string | The timestamp of the last update to the user's balance (e.g., "2025-03-18T14:32:05Z"). |