Check Balance
Retrieve your current active balance.
Retrieve your current account balance. The balance is in IDR (Indonesian Rupiah).
Endpoint
Request Headers
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
X-Api-Key | String | Yes | Your API Key. |
X-Timestamp | String | Yes | Current Unix timestamp in ms. |
X-Signature | String | Yes | HMAC-SHA256 signature. Sign timestamp only. |
Response
200OK
json
{
"success": true,
"data": {
"balance": 850000
}
}Example cURL
API_KEY="algan_live_..."
API_SECRET="sk_live_..."
TIMESTAMP=$(python3 -c "import time; print(int(time.time() * 1000))")
SIGNATURE=$(echo -n "${TIMESTAMP}" | \
openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')
curl -s https://algan.id/api/v1/balance \
-H "X-Api-Key: ${API_KEY}" \
-H "X-Timestamp: ${TIMESTAMP}" \
-H "X-Signature: ${SIGNATURE}"
Example (Node.js)
const crypto = require('crypto');
const API_KEY = 'algan_live_...';
const API_SECRET = 'sk_live_...';
const timestamp = Date.now().toString();
const signature = crypto.createHmac('sha256', API_SECRET).update(timestamp).digest('hex');
const res = await fetch('https://algan.id/api/v1/balance', {
headers: { 'X-Api-Key': API_KEY, 'X-Timestamp': timestamp, 'X-Signature': signature },
});
const { data } = await res.json();
console.log(`Balance: Rp ${data.balance.toLocaleString()}`);
Performance Note
ETag Support
This endpoint supports the ETag header. If your balance has not changed since the last request, the server returns 304 Not Modified with zero body, saving bandwidth. Send the ETag value from the previous response as If-None-Match in your next request.