/api/v1/vpn/subscriptions/{subscription_id}/upgradeСписывает доплату из upgrade-quote и переводит подписку на новый тариф.
curl -X POST https://api.relayhub.surf/api/v1/vpn/subscriptions/<subscription_id>/upgrade \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"custom_id": "11111111-1111-4111-8111-111111111111",
"new_plan_uuid": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}'{
"success": true,
"custom_id": "11111111-1111-4111-8111-111111111111",
"subscription": {
"subscription_id": "01a06315-1270-705a-8d4c-58fea607bf2c",
"external_user_id": "user-42",
"plan_uuid": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"plan_name": "Pro 30d",
"is_trial": false,
"status": "active",
"subscription_url": "https://api.relayhub.surf/sub/wnT9NRf0Zk6McRRnp2nggc3K",
"days": 30,
"days_left": 30,
"devices": 5,
"auto_renew": false,
"renewal_count": 0,
"created_at": "2026-09-02T12:00:00Z",
"end_date": "2026-10-02T12:00:00Z",
"price_minor": 750,
"price_usd": "7.50"
},
"charged_minor": 300,
"charged_usd": "3.00",
"balance_after_minor": 11600,
"balance_after_usd": "116.00"
}Заголовок Authorization: Bearer <ключ> на каждом запросе. Ключ один на аккаунт, выпускается в кабинете партнёра и показывается один раз. Он тратит депозит: держите его на сервере.
custom_idstringобязательноВаш идентификатор операции, уникальный в рамках аккаунта. Повтор запроса с тем же custom_id вернёт результат первой попытки без повторного списания.
new_plan_uuiduuidобязательноТариф из GET /plans, на который переходим.
successbooleanобязательноcustom_idstringобязательноsubscriptionobjectобязательноcharged_minorintegerобязательноcharged_usdstringобязательноbalance_after_minorintegerобязательноbalance_after_usdstringобязательно401unauthorized: Неверный или отсутствующий API-ключ402insufficient_balance: Недостаточно средств на депозите403api_disabled: Доступ к API для этого аккаунта закрыт404subscription_not_found: Подписка не найдена; plan_not_found: Тариф не найден или недоступен409subscription_frozen: Подписка заморожена; subscription_expired: Подписка истекла; subscription_state: Операция не подходит к текущему состоянию подписки; custom_id_conflict: Этот custom_id уже использован с другими параметрами; operation_in_progress: Операция с этим custom_id ещё выполняется422Validation Error429rate_limited: Слишком много запросов503upstream_unavailable: Поставщик VPN временно недоступенcurl -X POST https://api.relayhub.surf/api/v1/vpn/subscriptions/<subscription_id>/upgrade \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"custom_id": "11111111-1111-4111-8111-111111111111",
"new_plan_uuid": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}'{
"success": true,
"custom_id": "11111111-1111-4111-8111-111111111111",
"subscription": {
"subscription_id": "01a06315-1270-705a-8d4c-58fea607bf2c",
"external_user_id": "user-42",
"plan_uuid": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"plan_name": "Pro 30d",
"is_trial": false,
"status": "active",
"subscription_url": "https://api.relayhub.surf/sub/wnT9NRf0Zk6McRRnp2nggc3K",
"days": 30,
"days_left": 30,
"devices": 5,
"auto_renew": false,
"renewal_count": 0,
"created_at": "2026-09-02T12:00:00Z",
"end_date": "2026-10-02T12:00:00Z",
"price_minor": 750,
"price_usd": "7.50"
},
"charged_minor": 300,
"charged_usd": "3.00",
"balance_after_minor": 11600,
"balance_after_usd": "116.00"
}