Accounts
Endpoints for enumerating the authenticated user's accounts and reading
their balances. Use these to discover the debited_account_id you'll
pass on /v1/purchases/validate and /v1/purchases/confirm.
List accounts
http
GET /v1/accountsReturns every active account owned by the authenticated user, with the current balance embedded directly so you don't need a second round trip.
bash
curl https://api.scratchpower.com/v1/accounts \
-H "Authorization: Bearer $TOKEN"js
const res = await fetch("https://api.scratchpower.com/v1/accounts", {
headers: { Authorization: `Bearer ${token}` },
});
const accounts = await res.json();python
resp = requests.get(
"https://api.scratchpower.com/v1/accounts",
headers={"Authorization": f"Bearer {token}"},
)
accounts = resp.json()Response
json
[
{
"id": 13209,
"name": "Test Admin Account",
"currency": "BWP",
"category": "CURRENT",
"type": "WALLET",
"status": "ACTIVE",
"rank": 1,
"balance": "BWP 2878.86"
}
]Fields
| Field | Type | Notes |
|---|---|---|
id | integer | Pass as debited_account_id on purchases |
name | string | Display label set by the user / admin |
currency | string | ISO 4217 (e.g. BWP) |
category | string | CURRENT, COMMISSION, or TOPUP |
type | string | Always WALLET for now |
status | string | ACTIVE only — closed/suspended accounts are filtered out |
rank | integer | Display order if the user has multiple accounts |
balance | string | <CCY> <amount> — e.g. "BWP 2878.86" |
The balance string mirrors the format used on Transaction.entry / net / total / charge / commission. Parse with the same logic.
Get a single account
http
GET /v1/accounts/{id}bash
curl https://api.scratchpower.com/v1/accounts/13209 \
-H "Authorization: Bearer $TOKEN"Returns the same shape as a single element of the list response. Returns
404 if the id doesn't belong to the authenticated user (defence in
depth — the permission gate already restricts to your own accounts).