Check an account balance
Get Balance
Section titled “Get Balance”GET
https://gptunnel.ru/v1/balanceReturns the balance and credit limit of the selected account in rubles.
Call GET /v1/balance without parameters to find out which account the key belongs to.
- If
orgIdcontains an organization ID, the key belongs to that organization and the response shows its balance. Add?useWalletBalance=trueto get the key owner’s personal balance. - If
orgIdisnull, the key belongs to a personal account and always returns that account’s balance.
Query parameters
| Parameter | Type | Description |
|---|---|---|
useWalletBalance | bool | Get a personal account balance |
Request headers
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | API key |
Response
Section titled “Response”An HTTP 200 response contains all five fields.
Response fields
| Parameter | Type | Description |
|---|---|---|
orgId* | string | null | ID of the organization whose balance was returned. null for a personal balance, including when useWalletBalance=true |
userId* | string | ID of the API key owner, including when the response shows an organization balance |
object* | string | Object type. Always balance. |
balance* | number | Balance in rubles rounded to the nearest kopeck. It can be negative and excludes bonuses and the credit limit. |
creditLimit* | number | Credit limit in rubles. Always 0 for a personal account. |
Balance of the organization
{ "orgId": "ddc0652cde46d307200011c4", "userId": "0123456789abcdef01234567", "object": "balance", "balance": -51.54, "creditLimit": 15000}Personal balance of key holder
{ "orgId": null, "userId": "0123456789abcdef01234567", "object": "balance", "balance": 120.5, "creditLimit": 0}An example for a request without a key or with an unknown key.
{ "error": { "message": "Unauthorized", "type": "unauthorized_request_error", "param": null, "code": null }}