Transfer funds
Transfer of balance
Section titled “Transfer of balance”https://gptunnel.ru/api/v1/balance/transferThe API debits amount from the organization that owns the key and credits the same amount to the recipient. Specify the recipient in exactly one of the following ways.
user_idcredits the user’s personal account.org_idcredits the organization’s account.user_data.phonecredits the user’s personal account by phone number in the format+79XXXXXXXXX. Phone lookup must be enabled for the partner.
The transfer is atomic. Both balances update together. If the transfer fails, neither balance changes. The sender can find the transfer in the journal in the organization dashboard. The recipient sees a transfer in their transaction history.
Request headers
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | Organization API key |
Idempotency-Key* | string | Unique key for this transfer, 8–64 characters from A-Za-z0-9_- |
Content-Type* | string | application/json |
Request parameters
| Parameter | Type | Description |
|---|---|---|
user_id | string | Recipient user ID, 24 lowercase hexadecimal characters. Provide exactly one of user_id, org_id, and user_data. |
org_id | string | Recipient organization ID, 24 lowercase hexadecimal characters. Provide exactly one of user_id, org_id, and user_data. |
user_data | object | Look up the recipient by phone: {"phone":"+79XXXXXXXXX"}. This feature requires separate activation. |
amount* | number | Amount in rubles, greater than 0 and not more than 100,000, up to 2 decimal places |
Example request
Section titled “Example request”Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.
import jsonimport osfrom urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")if not key: raise SystemExit("Set GPTUNNEL_API_KEY")
body = { "user_id": "6ad72133269dc8d9f75a33bc", "amount": 500}request = Request( "https://gptunnel.ru/api/v1/balance/transfer", method="POST", headers={ "Authorization": key, "Content-Type": "application/json", "Idempotency-Key": "order-2026-10-20-000153", }, data=json.dumps(body).encode("utf-8"),)with urlopen(request, timeout=30) as response: print(json.load(response))curl --request POST \ --url 'https://gptunnel.ru/api/v1/balance/transfer' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: order-2026-10-20-000153' \ --data '{ "user_id": "6ad72133269dc8d9f75a33bc", "amount": 500}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const body = { "user_id": "6ad72133269dc8d9f75a33bc", "amount": 500}const response = await fetch("https://gptunnel.ru/api/v1/balance/transfer", { method: "POST", headers: { Authorization: key, "Content-Type": "application/json", "Idempotency-Key": "order-2026-10-20-000153", }, body: JSON.stringify(body),})if (!response.ok) throw new Error(await response.text())console.log(await response.json())Response
Section titled “Response”Response fields
| Parameter | Type | Description |
|---|---|---|
code | number | 0 on success |
transaction_id | string | The Idempotency-Key from your request. Use it to find the transfer in the transaction history or organization journal. |
org_id | string | Sending organization |
recipient_user_id | string | null | Recipient user ID when the transfer uses user_id |
recipient_org_id | string | null | Recipient organization ID when the transfer uses org_id |
recipient_created | boolean | Always false for transfers by ID |
amount | number | Amount credited to the recipient in rubles |
currency | string | Always RUB |
discount_percent | number | Partner discount on transfers, as a percentage. Zero if no discount is assigned. |
discount_amount | number | Amount of discount returned to the sender's balance as a separate transaction |
created_at | string | Transfer timestamp in ISO 8601 format |
replayed | boolean | true if the request repeated a transfer with the same Idempotency-Key |
{ "code": 0, "transaction_id": "order-2026-10-20-000153", "org_id": "6ad5e0c3269dc8d9f75a1f07", "recipient_user_id": "6ad72133269dc8d9f75a33bc", "recipient_org_id": null, "recipient_created": false, "amount": 500, "currency": "RUB", "discount_percent": 0, "discount_amount": 0, "created_at": "2026-10-20T09:15:42.000Z", "replayed": false}{ "code": 19, "message": "Insufficient funds on the organization balance."}{ "code": 20, "message": "Idempotency-Key was already used with a different request body."}Partnership discount
Section titled “Partnership discount”The recipient always receives the full amount. If the sending organization has a partner discount, the API debits the full transfer amount and credits the discount back to the sender in a separate transaction. The response shows the discount in discount_amount. Both entries appear in the transaction history.
Errors
Section titled “Errors”| HTTP | code | Cause |
|---|---|---|
| 400 | 3 | The request body does not match the schema. The recipient is missing, more than one recipient field is set, or the amount is outside the allowed range. See details. |
| 400 | 18 | The sending and receiving organizations are the same. |
| 400 | 21 | The Idempotency-Key header is missing or has an invalid format. |
| 403 | 16 | Transfers are enabled on the key, but the organization cannot send funds. Transfers are disabled for the organization, the organization has been deleted, or a distributor manages it. |
| 403 | 22 | Transfers are disabled on the key. A personal account key also returns this code. |
| 404 | 17 | No user was found with the given user_id. |
| 404 | 23 | The user account has been deleted. |
| 404 | 24 | No organization was found with the given org_id. |
| 404 | 25 | The receiving organization has been deleted. |
| 409 | 20 | The Idempotency-Key has already been used with a different request body. |
| 422 | 19 | Available funds, including the credit limit, do not cover the transfer. |
The server processes simultaneous transfers from the same organization one at a time. Queuing does not produce a separate error. If two requests arrive together with the same Idempotency-Key, the second waits for the first. If their bodies match, the second returns the original result with replayed: true. If the bodies differ, it returns HTTP 409 with code 20.
See the Business API error reference for the full list of codes, including the 401 response for an invalid key.