Skip to content

Transfer funds

POSThttps://gptunnel.ru/api/v1/balance/transfer

The 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_id credits the user’s personal account.
  • org_id credits the organization’s account.
  • user_data.phone credits 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

ParameterTypeDescription
Authorization*stringOrganization API key
Idempotency-Key*stringUnique key for this transfer, 8–64 characters from A-Za-z0-9_-
Content-Type*stringapplication/json

Request parameters

ParameterTypeDescription
user_idstringRecipient user ID, 24 lowercase hexadecimal characters. Provide exactly one of user_id, org_id, and user_data.
org_idstringRecipient organization ID, 24 lowercase hexadecimal characters. Provide exactly one of user_id, org_id, and user_data.
user_dataobjectLook up the recipient by phone: {"phone":"+79XXXXXXXXX"}. This feature requires separate activation.
amount*numberAmount in rubles, greater than 0 and not more than 100,000, up to 2 decimal places

Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.

import json
import os
from 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))

Response fields

ParameterTypeDescription
codenumber0 on success
transaction_idstringThe Idempotency-Key from your request. Use it to find the transfer in the transaction history or organization journal.
org_idstringSending organization
recipient_user_idstring | nullRecipient user ID when the transfer uses user_id
recipient_org_idstring | nullRecipient organization ID when the transfer uses org_id
recipient_createdbooleanAlways false for transfers by ID
amountnumberAmount credited to the recipient in rubles
currencystringAlways RUB
discount_percentnumberPartner discount on transfers, as a percentage. Zero if no discount is assigned.
discount_amountnumberAmount of discount returned to the sender's balance as a separate transaction
created_atstringTransfer timestamp in ISO 8601 format
replayedbooleantrue 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
}

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.

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.