REST API: users
Update group balance
Set the balance of a group; reserved for administrators.
Purpose
This call replaces the balance of an account group with the amount you send. It does not add to the balance. It is limited to administrator tokens: any other caller receives the failure answer with HTTP 400.
Request
POST <API_BASE_URL>/user/balance/update. All calls are POST under your API address. Replace <API_BASE_URL> with the API address provided with your access.
This operation takes no permanent API token. Send a user token in the token header. See authentication and user authorization.
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
groupId | number | yes | The group whose balance is replaced. |
amount | number | yes | The new balance. It replaces the stored value; it is not added to it. |
Response
HTTP 200. The balance was replaced.
| Field | Type | Description |
|---|---|---|
status | string | Always ok on this body. |
message | string | Human-readable detail. Never branch on it. |
balance | number | The amount you sent, echoed back unchanged, in the stored scale and not in the whole units that get group balance reports. |
Errors
400: The body failed validation, or the caller is not an administrator. The answer hasstatusoferror.401: The token is missing, expired or unknown.
A refusal can also come before the operation runs: an address outside your IP allowlist, a token bound to another address, or a body that is not valid JSON. See response format and errors.
Example
Request:
curl -X POST "<API_BASE_URL>/user/balance/update" \
-H "token: <your user token>" \
-H "Content-Type: application/json" \
-d '{
"groupId": 1,
"amount": 100000
}'
Response:
{
"status": "ok",
"message": "<detail>",
"balance": 100000
}