Appearance
staff.balance
3 methods on staff.balance. Each returns the answer's data and throws NoviqaError on a failed answer.
bulk
POST
/admin/v1/balance/bulkMoney operation for many accounts
Posts one money operation per item, all with the same action (balance, credit, bonus, charge, correction, commission, dividend, tax). items holds 1-1000 accounts, each with its login, amount (+ in, - out) and its own request_id (a new UUID, unique in the request; the same id sent again never pays twice). An item's comment falls back to the top-level comment; comments at most 64 characters. Each item runs and is journaled on its own: an account out of scope, unknown or short of money fails alone with status rejected and a code (forbidden, not_found, trade.no_money, invalid_input...); done rows carry the new deal_id. Actions: balance, credit, charge, correction, bonus, commission, dividend, dividend_franked (MT5 franked dividends), tax. skip_margin_check true is MT5's "Conduct balance operation without checking the free margin and the current balance on the account" (same rights). With the confirm_actions right the request needs confirm_token and confirm_code from POST /admin/v1/confirmations, else 403 confirmation_required (nothing runs).
More details
Rights: the staff member needs every one of: accounts.balance.
Request body
actionDealActionDealAction is the kind of deal: a trade or a money operation. -
balance: deposit (+) or withdrawal (-) - bonus: moves credit - correction: may leave the account short - dividend_franked: MT5 franked dividend: a dividend with tax already paid - interest: the month's interest paid on free margin - agent: agent commission paid to the agent account; Value is the amount in the client's currencybuy sell balance credit bonus charge correction commission dividend dividend_franked tax swap interest agentcommentstringused where an item has none
confirm_codestringthe code as the user typed it
confirm_tokenstringfrom POST /admin/v1/confirmations
itemsobject[]skip_margin_checkbooleanMT5: without checking the free margin and the current balance
Returns
Promise<BalanceRow[]>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
confirmation_required: confirm this action with the code shown403
forbidden: you do not have access to this action500
internal: something went wrongts
import { staff } from "@/lib/noviqa"
const data = await staff.balance.bulk({
action: "bonus",
comment: "September promo",
items: [
{
amount: "50.00",
login: 100234,
request_id: "0b8e2f4a-6c1d-4e3b-9a7f-5d2c1b0a9e8f"
},
{
amount: "50.00",
comment: "VIP",
login: 100235,
request_id: "1c9f3a5b-7d2e-4f4c-8b6a-6e3d2c1b0a9f"
}
]
})bash
curl -X POST "$NOVIQA_API_URL/admin/v1/balance/bulk" \
-H "Authorization: Bearer $NOVIQA_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"action": "bonus",
"comment": "September promo",
"items": [
{
"amount": "50.00",
"login": 100234,
"request_id": "0b8e2f4a-6c1d-4e3b-9a7f-5d2c1b0a9e8f"
},
{
"amount": "50.00",
"comment": "VIP",
"login": 100235,
"request_id": "1c9f3a5b-7d2e-4f4c-8b6a-6e3d2c1b0a9f"
}
]
}'json
{
"success": true,
"code": "ok",
"message": "done",
"data": [
{
"amount": "1.08452",
"code": "ok",
"deal_id": 1,
"login": 1001,
"message": "string",
"request_id": "3f2a9c1e-8b7d-4e6f-a5c4-1b2d3e4f5a6b",
"status": "done"
}
],
"request_id": "5b7f2c1e"
}ts
staff.balance.bulk(body: account.BulkBalance, options?: RequestOptions): Promise<account.BalanceRow[]>check
POST
/admin/v1/balance/checkCheck balances against history
For each login in logins (1-100, repeats counted once, answered in login order) compares the stored balance and credit with what the deals history sums to: balance / balance_valid (from history), credit / credit_valid, ok when both agree. Changes nothing; journals every value: balance of account 'x' has been checked: valid (credit likewise) or a warning account x has invalid balance: a, valid: b. A login that cannot be checked does not fail the request: its item holds only login and error (not found, forbidden, not a trading account for a manager or administrator account, or execution's refusal).
More details
Rights: the staff member needs every one of: accounts.balance.
Request body
loginsinteger[]Returns
Promise<BalanceItem[]>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action403
trade.disabled: trading is disabled500
internal: something went wrong504
trade.timeout: request timed outts
import { staff } from "@/lib/noviqa"
const data = await staff.balance.check({
logins: [
100234,
100235
]
})bash
curl -X POST "$NOVIQA_API_URL/admin/v1/balance/check" \
-H "Authorization: Bearer $NOVIQA_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"logins": [
100234,
100235
]
}'json
{
"success": true,
"code": "ok",
"message": "done",
"data": [
{
"balance": "1000.00",
"balance_valid": "1.08452",
"credit": "0.00",
"credit_valid": "1.08452",
"error": "string",
"login": 1001,
"ok": true
}
],
"request_id": "5b7f2c1e"
}ts
staff.balance.check(body: account.loginList, options?: RequestOptions): Promise<account.BalanceItem[]>fix
POST
/admin/v1/balance/fixFix balances from history
Like the check, but sets balance and credit to what the deals history sums to and answers the check as it was before the fix. Each fixed value writes a journal line (balance of account 'x' has been fixed from a to b), or one balance of account 'x' is valid, nothing to fix; the change reaches the account's terminals as a correction event. Accounts are fixed one after another; a login that cannot be fixed answers its error and the others still run.
More details
Rights: the staff member needs every one of: accounts.balance.
Request body
loginsinteger[]Returns
Promise<BalanceItem[]>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action403
trade.disabled: trading is disabled500
internal: something went wrong504
trade.timeout: request timed outts
import { staff } from "@/lib/noviqa"
const data = await staff.balance.fix({
logins: [
100234
]
})bash
curl -X POST "$NOVIQA_API_URL/admin/v1/balance/fix" \
-H "Authorization: Bearer $NOVIQA_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"logins": [
100234
]
}'json
{
"success": true,
"code": "ok",
"message": "done",
"data": [
{
"balance": "1000.00",
"balance_valid": "1.08452",
"credit": "0.00",
"credit_valid": "1.08452",
"error": "string",
"login": 1001,
"ok": true
}
],
"request_id": "5b7f2c1e"
}ts
staff.balance.fix(body: account.loginList, options?: RequestOptions): Promise<account.BalanceItem[]>