For AI agents: markdown of this page — /docs-content-en/infra/lifecycle/repair.md documentation index — /llms.txt
Repair tunnel
POST /v1/infra/servers/:id/repair
Starts a background repair of the Black Hole tunnel through the cloud provider's serial console. Use it when the virtual machine is in the running status, but blackholeStatus is stuck in DISCONNECTED or WAITING — that is, the tunnel agent is not connecting. The procedure goes through the serial console (bypassing the firewall) and includes: injecting an SSH key → connecting to the machine → fully reinstalling the agent at the latest version → waiting for it to reconnect. It takes up to 2 minutes (up to 4 minutes if the fallback install path was needed — see "Known specifics"); the call itself returns immediately and does not wait for completion. Track the progress via GET /repair-status.
This is not a way to clear
EXEC_BUSY./repairis a full reinstall of the tunnel agent: live processes started via/execare interrupted along with their side effects (for example, an openCOPYtransaction in an external database will hang and hold its locks until that side times out). If the server responds with409 EXEC_BUSY, release the lock withDELETE /v1/infra/servers/:id/lock— the agent and running processes are left untouched. Keep/repairfor the case it is meant for: the tunnel genuinely fails to connect.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string (UUID) | yes | Server ID |
The request body is empty.
Examples
curl — personal key
curl -X POST -H "X-Api-Key: YOUR_API_KEY" \
https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/repair
curl — OAuth application
curl -X POST -H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/repair
JavaScript — personal key
// Start the repair and poll the status periodically
await fetch(
`https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/repair`,
{ method: 'POST', headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
)
while (true) {
await new Promise(r => setTimeout(r, 10000))
const res = await fetch(
`https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/repair-status`,
{ headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
)
const { data } = await res.json()
console.log(`Step: ${data.step ?? data.status}`)
if (data.status === 'idle' || data.status === 'completed' || data.status === 'failed') break
}
JavaScript — OAuth application
await fetch(
`https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/repair`,
{
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
}
)
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | true — the repair was successfully started in the background |
data.status |
string | Always "started" on success |
Response example
{
"success": true,
"data": { "status": "started" }
}
Error response example
409 — repair blocked (for example, the server is marked preventWake=true):
{
"success": false,
"error": {
"code": "REPAIR_BLOCKED",
"message": "Repair blocked: server prevents wake"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_INPUT |
The record has no cloud virtual machine: provisioning never finished, or the machine was deleted on the provider's side — in that case, delete the server and create a new one. The same code is returned for a Galaxy app: the container has no machine of its own, so repair does not apply to it — see Galaxy app |
| 401 | MISSING_API_KEY |
The X-Api-Key header was not provided |
| 401 | INVALID_API_KEY |
Invalid or expired API key |
| 403 | INFRA_FORBIDDEN_FOR_COWORK_KEY |
The call was made with a Cowork/Code key — such a key works with data only and cannot perform write operations. To issue a key that can, see Project key for deploy |
| 403 | SERVER_ROLE_FORBIDDEN |
You are on this server's development team with the Developer role, and this operation is open to the Administrator role. error.hint carries your role, the required threshold and the list of calls that are open to you. Role breakdown — List servers |
| 404 | NOT_FOUND |
The server does not exist, was deleted, or belongs to another API key while you are not on its development team |
| 409 | REPAIR_BLOCKED |
Repair blocked: preventWake=true (billing freeze, administrative block) or the server is in a special state |
| 422 | GUEST_NOT_BOOTING |
The machine's guest operating system does not boot. Repair cannot fix that, so the call is refused before the machine is touched and does not wake it — the server has to be recreated |
| 429 | RATE_LIMITED |
The platform's overall request limit was exceeded |
The full list of common API errors — Errors.
Known specifics
- Why the serial console, not SSH. When the agent is not connected, SSH through the iptables of a BLACKHOLE server is unavailable. The Bitrix24 Cloud provider's serial console bypasses the firewall at the hypervisor level and lets you inject an SSH key into an already-running virtual machine without rebooting it.
- Two agent-install paths. By default the agent is reinstalled over inbound SSH — that is the fast path. When inbound SSH is unavailable (port 22 does not answer, the stored IP is stale, cloud firewall rules, sshd is down), the procedure installs the agent out-of-band over the same serial console: the agent only needs an OUTBOUND connection to the gateway, so inbound access is not required for a reinstall. A machine without a public IP uses the serial console directly. The fallback attempt adds up to two minutes to an already-failing call; if both paths fail, the
errorfield ofGET /repair-statuscarries both reasons joined by; serial fallback:. - Idempotent. The procedure runs a full cycle (stop the agent → download a fresh binary → clean configuration → start) and is safe for a healthy server — it cannot do harm. A repeated call during an ongoing repair simply returns 409 / the same
started, breaking nothing. - The server mode is preserved. An OPEN server stays OPEN (iptables is not touched), a BLACKHOLE one stays BLACKHOLE.
- How to unblock
REPAIR_BLOCKED. If the server is markedpreventWake(billing freeze, an expired trial, an admin block) — first resolve the cause (top up the balance, upgrade the plan), then retry/repair. GUEST_NOT_BOOTINGcannot be fixed by a repair. The marker is visible in advance in theprovisionErrorCodefield of the server record —GET /v1/infra/servers/:id. Read it before the call: for such a machine repair is refused, and the only action left is to delete the server and create a new one.