APISet Balance

Set Balance

Set a user's wallet balance to a specific value within a project. This endpoint allows administrators to directly set a user's balance rather than adjusting by a delta amount.

POST/v2/projects/{project_id}/balance/adjust

Authorization

Bearer TokenRequired

Path Parameters

project_idstringRequired

The unique identifier of the project.

Request Body

user_idstringRequired

The user ID to set balance for.

new_balancestringRequired

The new balance value to set (e.g., '10.00').

reasonstring

Optional reason for the balance change.

Request
curl -X POST "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/balance/adjust" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "123456789012345678",
    "new_balance": "10.00",
    "reason": "Promotional credit"
  }'
Balance set successfullyapplication/json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/YOUR_PROJECT_ID/balance/adjust",
  "code": 200,
  "message": "Balance adjusted successfully",
  "data": {
    "previous_balance": "0",
    "new_balance": "10",
    "adjustment": "10",
    "user_id": "123456789012345678",
    "transaction_id": "22222222-2222-2222-2222-222222222222",
    "reason": "Promotional credit"
  }
}

Last updated: