Balance
GEThttps://api.aerless.si/v1/credits
Your balance, for scripts and monitoring.
Response#
curl
curl https://api.aerless.si/v1/credits \
-H "Authorization: Bearer $AERLESS_API_KEY"Response
{
"object": "credits",
"unit": "usd",
"available": ‹dollars›,
"held": ‹dollars›,
"balance": ‹dollars›,
"available_micro": "‹micro-dollars›",
"held_micro": "‹micro-dollars›"
}| Field | Meaning |
|---|---|
available | US dollars you can spend now. |
held | Reserved by requests in progress. Returned when they finish, less what they cost. |
balance | available + held. |
available_micro | available as a string of micro-dollars (1 USD = 1,000,000), exact. |
held_micro | held as a string of micro-dollars. |
Low-balance check#
Warns when you can spend less than the minimum top-up. Run it from cron.
low-balance.sh
LOW=10
AVAILABLE=$(curl -s https://api.aerless.si/v1/credits \
-H "Authorization: Bearer $AERLESS_API_KEY" | jq -r .available)
awk -v a="$AVAILABLE" -v l="$LOW" 'BEGIN { exit !(a < l) }' \
&& echo "Low balance: $AVAILABLE USD"Top-ups, payment history and low-balance alerts are in the dashboard. See top-ups.