Balance
curl --request GET \
--url https://api.orthogonal.com/v1/credits/balance \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.orthogonal.com/v1/credits/balance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.orthogonal.com/v1/credits/balance"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)Credits API
Balance
Check your credit balance
GET
/
v1
/
credits
/
balance
Balance
curl --request GET \
--url https://api.orthogonal.com/v1/credits/balance \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.orthogonal.com/v1/credits/balance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.orthogonal.com/v1/credits/balance"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)Returns the current credit balance for the authenticated API key.
Authentication
Requires a valid API key viaAuthorization: Bearer YOUR_API_KEY.
- User API keys return the user’s credit balance.
- Organization API keys return the organization’s provider balance (revenue).
Response
{
"balance": "$5.00"
}
Response Fields
| Field | Type | Description |
|---|---|---|
balance | string | Formatted dollar balance |
Example
curl 'https://api.orthogonal.com/v1/credits/balance' \
-H 'Authorization: Bearer YOUR_API_KEY'
orth balance
const response = await fetch('https://api.orthogonal.com/v1/credits/balance', {
headers: {
'Authorization': `Bearer ${process.env.ORTHOGONAL_API_KEY}`
}
});
const { balance } = await response.json();
console.log(`Balance: ${balance}`);
import requests
import os
response = requests.get(
'https://api.orthogonal.com/v1/credits/balance',
headers={'Authorization': f'Bearer {os.environ["ORTHOGONAL_API_KEY"]}'}
)
balance = response.json()
print(f"Balance: {balance['balance']}")
Check Sufficiency
UsePOST /v1/credits/check to verify you have enough balance before making an API call:
curl -X POST 'https://api.orthogonal.com/v1/credits/check' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"amountCents": 100}'
{
"sufficient": true,
"balanceCents": 500000,
"requiredCents": 100,
"shortfallCents": 0
}
