Skip to main content

Balance

Two endpoints. Both require Authorization: Bearer <JWT>.

GET /v1/balance

Return every balance row the user has.

curl https://api.questkit.jairukchan.com/v1/balance \
-H "Authorization: Bearer <JWT>"

Response — 200 OK

{
"balances": [
{
"userId": "usr_demo_123",
"currency": "gold",
"amount": 1100,
"updatedAt": 1716100100000
},
{
"userId": "usr_demo_123",
"currency": "point",
"amount": 250,
"updatedAt": 1716090000000
}
]
}

An empty array (not 404) means the user is legitimately "0 of everything" — render that without a special case.


GET /v1/balance/:currency

Return the balance row for one currency.

curl https://api.questkit.jairukchan.com/v1/balance/gold \
-H "Authorization: Bearer <JWT>"

Response — 200 OK

{
"balance": {
"userId": "usr_demo_123",
"currency": "gold",
"amount": 1100,
"updatedAt": 1716100100000
}
}

Errors

HTTPerror codeMeaning
404balance_not_foundNo row exists for (userId, currency). Treat as 0 for display, or surface "never minted".

The 404 response is informative: it lets clients distinguish "never minted" from "minted-then-decremented-to-zero" if that matters. If it doesn't matter, treat 404 and amount: 0 the same way.