Get the account balance
const url = 'https://api.siprtc.io/v1/Accounts/example/Balance';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.siprtc.io/v1/Accounts/example/Balance \ --header 'Authorization: Basic <credentials>'Returns the prepaid balance of the account in the path, in US dollars. Calls, messages, numbers and other paid usage are debited from this balance as they happen, so it can go below zero.
A sub-account that belongs to the same company as its parent account (for example a portal user) is billed to the parent: its usage is debited from the parent’s balance, not from its own.
Call it with your own Auth ID, or as a parent account with a direct sub-account’s Auth ID in the path. The same response is served at /Accounts/{auth_id}/Balances.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Auth ID of the account (yours, or a direct sub-account’s)
Responses
Section titled “ Responses ”The account and its balance
object
Auth ID of the account the balance belongs to.
Prepaid balance in US dollars. Negative when usage has exceeded the credit.
Example
{ "auth_id": "AC000000000000000000", "balance": 42.75}Missing or wrong credentials, or the path account is neither yours nor a direct sub-account’s (body: "Authentication failed")
Example generated
exampleNo account with this Auth ID (body: {})
object
Example generated
{}