Numbers API
Документация (RU) ▼
Базовый URL: https://turbon.rent/api/numbers
Аутентификация: во всех методах используется параметр key (API‑ключ пользователя).
action: во всех методах передавайте параметр action=... в query string.
Тарифы: sms_only (SMS) и calls_sms (DID: звонки + SMS).
DID: длительность фиксированная 720 часов (это 30 дней / 1 месяц). Параметр длительности в DID‑запросах не требуется.
Статусы аренды: active, expired, failed.
Длительности для SMS‑тарифа (sms_only):
24— 1 день72— 3 дня168— 7 дней720— 30 дней2160— 3 месяца4320— 6 месяцев
Методы
1) products — список доступных номеров и тарифов
Назначение: вернуть доступные номера по стране и выбранному типу тарифа, плюс список допустимых сроков и их цены.
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | products |
key | string | да | API‑ключ |
country | string | нет | фильтр по стране (например US) |
tariff_type | string | нет | sms_only или calls_sms |
Запрос:
https://turbon.rent/api/numbers?action=products&key=YOUR_API_KEY&country=DE&tariff_type=calls_sms
Ответ (200):
{
"items": [
{
"country": "DE",
"country_name": "Германия",
"tariff_type": "calls_sms",
"numbers_available": 12,
"numbers": [
{ "masked_number": "420ххххх7890" }
],
"tariffs": [
{ "duration_hours": 720, "duration_label": "30 days", "price": "25.00" }
]
}
]
}
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
items | array | да | Список стран/предложений |
items[] | object | да | Элемент списка |
country | string | да | ISO страны |
country_name | string | да | Название страны |
tariff_type | string | да | sms_only или calls_sms |
numbers_available | int | да | Количество доступных к моментальной выдаче номеров по направлению. 0 — живого стока сейчас нет (возможен только предзаказ на витрине; purchase вернёт NO_NUMBERS). |
numbers | array | да | Превью доступных номеров (замаскированы). Только образец: список ограничен (до 20 масок), поэтому размер может быть меньше numbers_available — для оценки наличия используйте numbers_available. |
numbers[] | object | да | Элемент списка |
masked_number | string | да | Замаскированный номер (только превью; конкретный номер при покупке не выбирается) |
tariffs | array | да | Доступные сроки для выбранного тарифа |
tariffs[] | object | да | Элемент списка |
duration_hours | int | да | Срок (в часах) |
duration_label | string | да | Человеческое отображение |
price | string | да | Цена (USD) |
2) purchase — купить аренду номера (создать rental)
Назначение: купить номер по стране/тарифу/сроку. Конкретный номер не выбирается — система выдаёт случайный свободный номер указанного направления. Возвращает id (это и есть rental_id) и сам number.
Где взять rental_id? в ответе purchase и также в списке аренды GET /api/numbers/rentals?action=rentals.
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | purchase |
key | string | да | API‑ключ |
country | string | да | код страны (например DE) |
tariff_type | string | да | sms_only или calls_sms |
duration_hours | int | нет | обязателен только для sms_only. Для calls_sms фиксирован 720ч. |
promo_code | string | нет | промокод (если поддерживается в интерфейсе) |
sip_mode | string | нет | только для calls_sms: registration или relay |
sip_peer_ip | string | нет | только для relay (IP клиента) |
sip_peer_port | int | нет | только для relay (порт) |
sip_prefix | string | нет | префикс (для отображения) |
Запрос (SMS-only):
{
"key": "YOUR_API_KEY",
"country": "DE",
"tariff_type": "sms_only",
"duration_hours": 24
}
POST:
https://turbon.rent/api/numbers/rentals?action=purchase
Запрос (DID / calls_sms):
{
"key": "YOUR_API_KEY",
"country": "DE",
"tariff_type": "calls_sms",
"sip_mode": "relay",
"sip_peer_ip": "1.2.3.4",
"sip_peer_port": 5060,
"sip_prefix": "DE1"
}
Ответ (200):
{
"rental": {
"id": "1001",
"number": "+4915110000000",
"tariff_type": "sms_only",
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"expires_at": "2026-03-19T10:00:00Z",
"price": "5.00",
"auto_renew": false
}
}
Ошибка (нет свободных номеров):
{ "error": "No numbers available for this country", "code": "NO_NUMBERS" }
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
rental | object | да | Созданная аренда |
id | string|int | да | rental_id |
number | string | да | Выданный номер телефона |
tariff_type | string | да | sms_only/calls_sms |
status | string | да | active/expired/failed |
created_at | string | да | ISO начало |
expires_at | string | да | ISO конец |
price | string | да | Цена в USD |
auto_renew | boolean | да | Автопродление включено |
auto_renew_duration_hours | int | нет | Если автопродление включено |
3) extend — продлить аренду номера
Назначение: продлить аренду на срок.
DID: для calls_sms параметр duration_hours не передаётся — всегда продление на 720ч.
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | extend |
key | string | да | API‑ключ |
duration_hours | int | нет | только для sms_only (из списка допустимых сроков) |
rental_id | string|int | да | ID аренды |
POST:
https://turbon.rent/api/numbers/rentals?action=extend&rental_id=RENTAL_ID
Body (SMS-only):
{
"key": "YOUR_API_KEY",
"duration_hours": 168
}
Body (DID / calls_sms):
{
"key": "YOUR_API_KEY"
}
Ответ (200):
{
"rental": {
"id": "1001",
"tariff_type": "sms_only",
"status": "active",
"expires_at": "2026-04-03T10:00:00Z",
"price": "15.00",
"auto_renew": false
}
}
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
rental | object | да | Обновлённая аренда |
id | string|int | да | rental_id |
tariff_type | string | да | sms_only/calls_sms |
status | string | да | active/expired/failed |
expires_at | string | да | Новая дата окончания |
price | string | да | Цена продления в USD |
auto_renew | boolean | да | Автопродление включено/нет |
auto_renew_duration_hours | int | нет | Если авто включено |
4) auto-renew/enable — включить автопродление
Назначение: включает автопродление аренды. При обычном продлении списание есть, но при автопродлении списание будет происходить при истечении срока (когда включено автопродление в системе).
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | auto_renew_enable |
key | string | да | API‑ключ |
duration_hours | int | нет | только для sms_only. Для DID фиксировано 720ч. |
rental_id | string|int | да | ID аренды |
https://turbon.rent/api/numbers/rentals?action=auto_renew_enable&rental_id=RENTAL_ID
Body (SMS-only):
{
"key": "YOUR_API_KEY",
"duration_hours": 720
}
Body (DID / calls_sms):
{
"key": "YOUR_API_KEY"
}
Ответ (200):
{
"rental": {
"id": "1001",
"auto_renew": true,
"auto_renew_duration_hours": 720
}
}
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
rental | object | да | Аренда |
id | string|int | да | rental_id |
auto_renew | boolean | да | Включено |
auto_renew_duration_hours | int | нет | Длительность авто‑продления (если передана/применима) |
5) auto-renew/disable — выключить автопродление
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | auto_renew_disable |
key | string | да | API‑ключ |
rental_id | string|int | да | ID аренды |
https://turbon.rent/api/numbers/rentals?action=auto_renew_disable&rental_id=RENTAL_ID
Ответ:
{ "rental": { "id": "1001", "auto_renew": false } }
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
rental | object | да | Аренда |
id | string|int | да | rental_id |
auto_renew | boolean | да | Отключено |
6) rentals — список моих арендуемых номеров
Назначение: вернуть аренды пользователя.
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | rentals |
key | string | да | API‑ключ |
status | string | нет | active/expired/failed |
tariff_type | string | нет | фильтр sms_only/calls_sms |
Запрос:
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&status=active&tariff_type=calls_sms&action=rentals
Ответ (200):
{
"items": [
{
"id": "1001",
"number": "+4915110000000",
"tariff_type": "sms_only",
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"expires_at": "2026-03-19T10:00:00Z",
"price": "5.00",
"auto_renew": false
}
]
}
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
items | array | да | Список аренды |
items[] | object | да | Карточка аренды |
id | string|int | да | rental_id |
number | string | да | Номер телефона |
tariff_type | string | да | sms_only/calls_sms |
status | string | да | active/expired/failed |
created_at | string | да | ISO время создания |
expires_at | string | да | ISO время окончания |
price | string | да | Цена в USD |
auto_renew | boolean | да | Автопродление включено |
7) rentals/RENTAL_ID — детали аренды
Назначение: вернуть карточку аренды по ID.
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | rental_get |
key | string | да | API‑ключ |
rental_id | string|int | да | ID аренды |
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=rental_get&rental_id=RENTAL_ID
{
"rental": {
"id": "1001",
"number": "+4915110000000",
"tariff_type": "sms_only",
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"expires_at": "2026-03-19T10:00:00Z",
"price": "5.00",
"auto_renew": false
}
}
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
rental | object | да | Карточка аренды |
id | string|int | да | rental_id |
number | string | да | Номер телефона |
tariff_type | string | да | sms_only/calls_sms |
status | string | да | active/expired/failed |
created_at | string | да | ISO время создания |
expires_at | string | да | ISO время окончания |
price | string | да | Цена в USD |
auto_renew | boolean | да | Автопродление включено |
8) sms/last — последняя SMS
Назначение: получить последнюю входящую SMS по аренде.
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | sms_last |
key | string | да | API‑ключ |
rental_id | string|int | да | ID аренды |
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=sms_last&rental_id=RENTAL_ID
Ответ (SMS есть):
{
"sms": {
"id": 9001,
"recv_time": "2026-03-18T10:05:00Z",
"from_number": "BANK",
"content": "Code: 123456"
}
}
Ответ (SMS нет):
{ "sms": null, "code": "NO_SMS_YET" }
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
sms | object|null | да | Последняя SMS или null |
sms.id | int | да | Идентификатор сообщения |
sms.recv_time | string | да | ISO время получения |
sms.from_number | string | да | Источник |
sms.content | string | да | Текст сообщения |
code | string | нет | Например NO_SMS_YET, когда SMS ещё нет |
9) calls — история звонков (только DID)
Назначение: вернуть список звонков по аренде DID.
Ограничение: если tariff_type != calls_sms — HTTP 409.
{ "error": "This number tariff is not DID", "code": "RENTAL_NOT_DID" }
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | calls |
key | string | да | API‑ключ |
rental_id | string|int | да | ID аренды |
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=calls&rental_id=RENTAL_ID
{
"items": [
{ "id": 5001, "started_at": "2026-03-18T10:10:00Z", "ended_at": "2026-03-18T10:10:20Z", "caller_id": "+1202...", "duration_seconds": 60, "status": "answered", "recording_id": 5001 }
]
}
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
items | array | да | Список звонков |
items[] | object | да | Элемент списка |
id | int | да | Идентификатор звонка |
started_at | string | да | ISO начало |
ended_at | string | да | ISO конец |
caller_id | string | нет | Идентификатор звонящего |
duration_seconds | int | да | Длительность в секундах |
status | string | да | Статус звонка |
recording_id | int | да | ID записи для скачивания |
10) recordings/RECORDING_ID/download — скачать запись звонка
| Параметр | Тип | Обязателен | Описание |
|---|---|---|---|
action | string | да | recording_download |
key | string | да | API‑ключ |
recording_id | string|int | да | ID записи |
Возвращает: бинарный поток файла (не JSON).
https://turbon.rent/api/numbers/recordings?key=YOUR_API_KEY&action=recording_download&recording_id=RECORDING_ID
Параметры ответа:
| Поле | Тип | Обязателен | Описание |
|---|---|---|---|
response_body | binary | да | Файл аудиозаписи |
Content-Type | string | нет | Например audio/mpeg (зависит от реализации) |
Webhooks (пуш-уведомления)
Вместо поллинга вы можете получать события на свой HTTPS-эндпоинт. Мы отправляем POST при двух событиях:
sms.received— на арендованный номер пришла входящая SMS (Numbers API).otp.code— по вашей OTP-активации пришёл код (OTP API).
Оба события идут на один и тот же URL; тип — в поле event тела и в заголовке X-Turbon-Event.
Настройка webhook
Эндпоинт: https://turbon.rent/api/webhook (аутентификация параметром key). Также настраивается в личном кабинете на странице API.
| action | Метод | Описание |
|---|---|---|
set | POST | Задать/изменить url (только https:// и доменное имя; literal-IP и localhost запрещены). Включает webhook. |
get | GET | Текущая конфигурация (без секрета). |
disable | POST | Выключить webhook. |
rotate_secret | POST | Сгенерировать новый секрет подписи (возвращается один раз). |
test | POST | Отправить тестовое событие webhook.test на ваш URL. |
deliveries | GET | Последние 50 доставок со статусами (для отладки). |
Пример — задать URL:
POST https://turbon.rent/api/webhook
Content-Type: application/x-www-form-urlencoded
key=YOUR_API_KEY&action=set&url=https://your-host.com/webhook
Ответ (200):
{
"webhook": {
"url": "https://your-host.com/webhook",
"is_active": true,
"is_enabled": true,
"has_secret": true,
"auto_disabled_at": null,
"consecutive_failures": 0
}
}
Секрет подписи возвращается один раз — при rotate_secret:
{ "secret": "e3b0c44298fc1c149afbf4c8996fb924..." }
Ошибки: неверный ключ — 403 BAD_KEY; webhooks выключены — 403 DISABLED; недопустимый URL — 400 BAD_URL; слишком много запросов — 429 CHANNEL_LIMIT (мутации: 20/мин).
Структура пуш-запроса
Мы отправляем на ваш URL POST с Content-Type: application/json и заголовками:
| Заголовок | Описание |
|---|---|
X-Turbon-Event | Тип события: sms.received или otp.code |
X-Turbon-Delivery | Идентификатор события id (для дедупликации) |
X-Turbon-Signature | Подпись: t=<unix>,v1=<HMAC-SHA256> |
User-Agent | turbon-rent-webhooks/1.0 |
Общий конверт тела:
{
"event": "sms.received",
"id": "3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
"created_at": "2026-07-11T10:15:30Z",
"api_version": "2026-07-11",
"data": { ... }
}
data для sms.received:
{
"rental_id": 1000000123,
"phone": "+48123456789",
"from": "Google",
"text": "G-123456 is your code",
"received_at": "2026-07-11T10:15:29Z"
}
| Поле | Тип | Описание |
|---|---|---|
rental_id | int|null | ID аренды (как в Numbers API). null для offline-аренды. |
phone | string | Ваш номер-получатель |
from | string | Отправитель SMS |
text | string | Текст сообщения |
received_at | string | ISO-8601 UTC, время получения |
data для otp.code:
{
"activation_id": 456,
"phone": "+79991234567",
"service": "telegram",
"country": "ru",
"code": "123456",
"received_at": "2026-07-11T10:15:29Z"
}
| Поле | Тип | Описание |
|---|---|---|
activation_id | int | ID активации (тот же, что вернул getNumber в OTP API: ACCESS_NUMBER:<activation_id>:<phone>) |
phone | string | Номер активации |
service | string | Код сервиса |
country | string | ISO страны |
code | string | Полученный код |
received_at | string | ISO-8601 UTC |
Проверка подписи
Заголовок X-Turbon-Signature имеет вид t=<unix>,v1=<hex>. Проверка:
- Возьмите сырое тело запроса (байты, как получили) и значение
t. - Вычислите
HMAC-SHA256(secret, "<t>.<raw_body>")в hex и сравните сv1(constant-time). - Отклоняйте запрос, если
|now − t| > 5 минут(защита от replay).
Пример (Python):
import hmac, hashlib, time
def verify(secret, header, raw_body):
parts = dict(p.split('=', 1) for p in header.split(','))
t, v1 = parts['t'], parts['v1']
if abs(time.time() - int(t)) > 300:
return False
expected = hmac.new(secret.encode(), f"{t}.{raw_body}".encode(),
hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, v1)
Доставка, ретраи и идемпотентность
- Отвечайте
2xxв течение 10 секунд, чтобы подтвердить приём. - Не-2xx или таймаут → повтор с возрастающей задержкой: ≈1м, 5м, 15м, 1ч, 3ч, 6ч, 12ч (до 8 попыток, ~22 часа), затем событие отбрасывается.
- Доставка at-least-once: одно событие может прийти повторно (например, если ваш
2xxне дошёл). Дедуплицируйте по полюid(оно же в заголовкеX-Turbon-Delivery). - После 20 подряд полностью неудачных событий webhook авто-выключается; включите заново через
set. - Служебные/технические SMS не пушатся.
Documentation (EN) ▼
Base URL: https://turbon.rent/api/numbers
Authentication: use key (user API key) in every method.
action: pass action=... in query string for every method.
Tariffs: sms_only (SMS) and calls_sms (DID: calls + SMS).
DID: fixed duration 720 hours (30 days / 1 month). Do not pass duration for DID requests.
Rental statuses: active, expired, failed.
SMS-only durations: 24, 72, 168, 720, 2160, 4320 hours.
Methods
1) products — list available numbers and tariffs
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | products |
key | string | yes | API key |
country | string | no | Country filter, e.g. US |
tariff_type | string | no | sms_only or calls_sms |
Request:
https://turbon.rent/api/numbers?action=products&key=YOUR_API_KEY&country=DE&tariff_type=calls_sms
Response (200):
{
"items": [
{
"country": "DE",
"country_name": "Germany",
"tariff_type": "calls_sms",
"numbers_available": 12,
"numbers": [
{ "masked_number": "420xxxxx7890" }
],
"tariffs": [
{ "duration_hours": 720, "duration_label": "30 days", "price": "25.00" }
]
}
]
}
numbers_available (int) — the number of numbers available for immediate purchase for this country/tariff. 0 means no live stock right now (purchase returns NO_NUMBERS). numbers is only a masked sample (capped at 20 entries), so its length may be smaller than numbers_available; use numbers_available to gauge availability.
2) purchase — create number rental
You don't pick a specific number — the system assigns a random free number of the requested country. The response returns the assigned number.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | purchase |
key | string | yes | API key |
country | string | yes | Country code, e.g. DE |
tariff_type | string | yes | sms_only or calls_sms |
duration_hours | int | no | Required for sms_only |
Request (POST URL):
https://turbon.rent/api/numbers/rentals?action=purchase
Request (POST body, sms_only example):
{
"key": "YOUR_API_KEY",
"country": "DE",
"tariff_type": "sms_only",
"duration_hours": 24
}
Response (200):
{
"rental": {
"id": "1001",
"number": "+4915110000000",
"tariff_type": "sms_only",
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"expires_at": "2026-03-19T10:00:00Z",
"price": "5.00",
"auto_renew": false
}
}
3) extend — extend rental
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | extend |
key | string | yes | API key |
rental_id | string|int | yes | Rental ID |
duration_hours | int | no | Only for sms_only |
Request (POST URL):
https://turbon.rent/api/numbers/rentals?action=extend&rental_id=RENTAL_ID
Request (POST body, sms_only example):
{
"key": "YOUR_API_KEY",
"duration_hours": 168
}
Response (200):
{
"rental": {
"id": "1001",
"tariff_type": "sms_only",
"status": "active",
"expires_at": "2026-04-03T10:00:00Z",
"price": "15.00",
"auto_renew": false
}
}
4) auto-renew/enable — enable auto-renew
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | auto_renew_enable |
key | string | yes | API key |
rental_id | string|int | yes | Rental ID |
duration_hours | int | no | Only for sms_only |
Request (POST URL):
https://turbon.rent/api/numbers/rentals?action=auto_renew_enable&rental_id=RENTAL_ID
Request (POST body, sms_only example):
{
"key": "YOUR_API_KEY",
"duration_hours": 720
}
Response (200):
{
"rental": {
"id": "1001",
"auto_renew": true,
"auto_renew_duration_hours": 720
}
}
5) auto-renew/disable — disable auto-renew
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | auto_renew_disable |
key | string | yes | API key |
rental_id | string|int | yes | Rental ID |
Request (POST URL):
https://turbon.rent/api/numbers/rentals?action=auto_renew_disable&rental_id=RENTAL_ID
Request (POST body):
{ "key": "YOUR_API_KEY" }
Response (200):
{ "rental": { "id": "1001", "auto_renew": false } }
6) rentals — list user rentals
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | rentals |
key | string | yes | API key |
status | string | no | active/expired/failed |
tariff_type | string | no | sms_only/calls_sms |
Request:
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=rentals
Response (200):
{
"items": [
{
"id": "1001",
"number": "+4915110000000",
"tariff_type": "sms_only",
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"expires_at": "2026-03-19T10:00:00Z",
"price": "5.00",
"auto_renew": false
}
]
}
7) rental_get — rental details
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | rental_get |
key | string | yes | API key |
rental_id | string|int | yes | Rental ID |
Request:
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=rental_get&rental_id=RENTAL_ID
Response (200):
{
"rental": {
"id": "1001",
"number": "+4915110000000",
"tariff_type": "sms_only",
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"expires_at": "2026-03-19T10:00:00Z",
"price": "5.00",
"auto_renew": false
}
}
8) sms_last — last SMS
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | sms_last |
key | string | yes | API key |
rental_id | string|int | yes | Rental ID |
Request:
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=sms_last&rental_id=RENTAL_ID
Response (SMS exists):
{
"sms": {
"id": 9001,
"recv_time": "2026-03-18T10:05:00Z",
"from_number": "BANK",
"content": "Code: 123456"
}
}
Response (no SMS yet):
{ "sms": null, "code": "NO_SMS_YET" }
9) calls — call records (DID only)
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | calls |
key | string | yes | API key |
rental_id | string|int | yes | Rental ID |
Request:
https://turbon.rent/api/numbers/rentals?key=YOUR_API_KEY&action=calls&rental_id=RENTAL_ID
If tariff_type != calls_sms, return 409 with RENTAL_NOT_DID.
Response (200):
{
"items": [
{ "id": 5001, "started_at": "2026-03-18T10:10:00Z", "ended_at": "2026-03-18T10:10:20Z", "caller_id": "+1202...", "duration_seconds": 60, "status": "answered", "recording_id": 5001 }
]
}
Response (409):
{ "error": "This number tariff is not DID", "code": "RENTAL_NOT_DID" }
10) recording_download — download call recording
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | yes | recording_download |
key | string | yes | API key |
recording_id | string|int | yes | Recording ID |
Request:
https://turbon.rent/api/numbers/recordings?key=YOUR_API_KEY&action=recording_download&recording_id=RECORDING_ID
Returns binary file stream (not JSON).
Webhooks (push notifications)
Instead of polling, you can receive events on your HTTPS endpoint. We send a POST for two events:
sms.received— an inbound SMS arrived on your rented number (Numbers API).otp.code— a code arrived for your OTP activation (OTP API).
Both events go to the same URL; the type is in the body field event and the X-Turbon-Event header.
Configuring the webhook
Endpoint: https://turbon.rent/api/webhook (authenticate with the key parameter). You can also configure it in your account on the API page.
| action | Method | Description |
|---|---|---|
set | POST | Set/update url (https:// and a domain name only; literal IPs and localhost are rejected). Enables the webhook. |
get | GET | Current configuration (without the secret). |
disable | POST | Disable the webhook. |
rotate_secret | POST | Generate a new signing secret (returned once). |
test | POST | Send a webhook.test event to your URL. |
deliveries | GET | Last 50 deliveries with statuses (for debugging). |
Example — set the URL:
POST https://turbon.rent/api/webhook
Content-Type: application/x-www-form-urlencoded
key=YOUR_API_KEY&action=set&url=https://your-host.com/webhook
Response (200):
{
"webhook": {
"url": "https://your-host.com/webhook",
"is_active": true,
"is_enabled": true,
"has_secret": true,
"auto_disabled_at": null,
"consecutive_failures": 0
}
}
The signing secret is returned once, on rotate_secret:
{ "secret": "e3b0c44298fc1c149afbf4c8996fb924..." }
Errors: bad key — 403 BAD_KEY; webhooks disabled — 403 DISABLED; invalid URL — 400 BAD_URL; too many requests — 429 CHANNEL_LIMIT (mutations: 20/min).
Push request structure
We send a POST to your URL with Content-Type: application/json and these headers:
| Header | Description |
|---|---|
X-Turbon-Event | Event type: sms.received or otp.code |
X-Turbon-Delivery | Event id (use it for deduplication) |
X-Turbon-Signature | Signature: t=<unix>,v1=<HMAC-SHA256> |
User-Agent | turbon-rent-webhooks/1.0 |
Common envelope:
{
"event": "sms.received",
"id": "3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
"created_at": "2026-07-11T10:15:30Z",
"api_version": "2026-07-11",
"data": { ... }
}
data for sms.received:
{
"rental_id": 1000000123,
"phone": "+48123456789",
"from": "Google",
"text": "G-123456 is your code",
"received_at": "2026-07-11T10:15:29Z"
}
| Field | Type | Description |
|---|---|---|
rental_id | int|null | Rental ID (same as Numbers API). null for offline rentals. |
phone | string | Your receiving number |
from | string | SMS sender |
text | string | Message text |
received_at | string | ISO-8601 UTC receive time |
data for otp.code:
{
"activation_id": 456,
"phone": "+79991234567",
"service": "telegram",
"country": "ru",
"code": "123456",
"received_at": "2026-07-11T10:15:29Z"
}
| Field | Type | Description |
|---|---|---|
activation_id | int | Activation ID (same one returned by getNumber in the OTP API: ACCESS_NUMBER:<activation_id>:<phone>) |
phone | string | Activation number |
service | string | Service code |
country | string | Country ISO |
code | string | Received code |
received_at | string | ISO-8601 UTC |
Verifying the signature
The X-Turbon-Signature header has the form t=<unix>,v1=<hex>. To verify:
- Take the raw request body (bytes as received) and the
tvalue. - Compute
HMAC-SHA256(secret, "<t>.<raw_body>")in hex and compare tov1(constant-time). - Reject the request if
|now − t| > 5 minutes(replay protection).
Example (Python):
import hmac, hashlib, time
def verify(secret, header, raw_body):
parts = dict(p.split('=', 1) for p in header.split(','))
t, v1 = parts['t'], parts['v1']
if abs(time.time() - int(t)) > 300:
return False
expected = hmac.new(secret.encode(), f"{t}.{raw_body}".encode(),
hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, v1)
Delivery, retries and idempotency
- Respond
2xxwithin 10 seconds to acknowledge. - Non-2xx or timeout → retried with increasing delay: ≈1m, 5m, 15m, 1h, 3h, 6h, 12h (up to 8 attempts, ~22 hours), then the event is dropped.
- Delivery is at-least-once: an event may arrive more than once (e.g. if your
2xxdid not reach us). Deduplicate on theidfield (also sent asX-Turbon-Delivery). - After 20 consecutive fully-failed events the webhook is auto-disabled; re-enable it via
set. - Service/technical SMS are not pushed.