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.

FieldTypeRequiredDescription
groupIdnumberyesThe group whose balance is replaced.
amountnumberyesThe new balance. It replaces the stored value; it is not added to it.

Response

HTTP 200. The balance was replaced.

FieldTypeDescription
statusstringAlways ok on this body.
messagestringHuman-readable detail. Never branch on it.
balancenumberThe 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 has status of error.
  • 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
}

Questions about access?

Write to us and we will help.

Talk to us