For AI agents: markdown of this page — /docs-content-en/infra/lifecycle/repair-status.md documentation index — /llms.txt
Repair status
GET /v1/infra/servers/:id/repair-status
Returns the progress of a background tunnel repair started via POST /repair. Used for periodic polling: the client sees the current step (wake / serial_console / ssh_install / connect / …), the final status (running / done / failed), and, in case of an error, the error field. Completed records are cleared automatically after 10 minutes.
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string (UUID) | yes | Server ID |
Examples
curl — personal key
curl -H "X-Api-Key: YOUR_API_KEY" \
https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/repair-status
curl — OAuth application
curl -H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
https://vibecode.bitrix24.com/v1/infra/servers/SERVER_ID/repair-status
JavaScript — personal key
// Progress polling loop
while (true) {
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()
if (data.status === 'idle') { console.log('Repair not started'); break }
if (data.status === 'done') { console.log(`Done, step: ${data.step}`); break }
if (data.status === 'failed'){ console.error(`Error at step ${data.step}: ${data.error}`); break }
console.log(`Step: ${data.step}`)
await new Promise(r => setTimeout(r, 10000))
}
JavaScript — OAuth application
const res = await fetch(
`https://vibecode.bitrix24.com/v1/infra/servers/${serverId}/repair-status`,
{
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
}
)
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.status |
string | idle (repair not started or cleared by timeout), running (in progress), done (succeeded), failed (failed) |
data.step |
string | Current/last step: wake, serial_console, ssh_install, connect, iptables, cleanup, done |
data.agentVersion |
string | null | Version of the installed agent (filled in at the ssh_install step) |
data.wasSlept |
boolean | Whether the server was sleeping when the repair started (then after done it returns to sleeping) |
data.error |
string | Error text, if status: "failed" |
data.startedAt |
number | Repair start timestamp (Unix milliseconds) |
For status: "idle", only the status field is returned; the remaining fields are absent.
Response example
Repair not started:
{
"success": true,
"data": {
"status": "idle"
}
}
Repair in progress, agent installation step completed:
{
"success": true,
"data": {
"status": "running",
"step": "connect",
"agentVersion": "1.2.3",
"wasSlept": false,
"startedAt": 1745312400000
}
}
Repair failed:
{
"success": true,
"data": {
"status": "failed",
"step": "ssh_install",
"agentVersion": null,
"wasSlept": false,
"error": "SSH connection refused",
"startedAt": 1745312400000
}
}
Error response example
404 — server does not exist:
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Server not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 401 | MISSING_API_KEY |
The X-Api-Key header was not provided |
| 401 | INVALID_API_KEY |
Invalid or expired API key |
| 404 | NOT_FOUND |
Server does not exist, was deleted, or belongs to another API key |
| 429 | RATE_LIMITED |
The platform-wide request limit was exceeded |
Full list of common API errors — Errors.
Known specifics
- Step execution order:
wake(if the server issleeping) →serial_console(inject the SSH key via the Bitrix24 Cloud serial console) →ssh_install(SSH connection and agent reinstall: download the binary, write the configuration, start the service) →connect(wait for the agent to connect to the Gateway) →iptables(restore the firewall for BLACKHOLE) →cleanup(return tosleepingif the server was sleeping) →done. - Right after
POST /repairthe status is alreadyrunning, notidle. The status is set torunningsynchronously when the repair starts, so the very firstrepair-statuspoll (even milliseconds later) seesrunning. Previously there was a brief window where a poll could seeidleand the poll loop exited prematurely — that window is now gone. - TTL of completed records — 10 minutes. After that, a repeat poll returns
idle. If you need to confirm the result after the TTL, look atblackholeStatusinGET /v1/infra/servers/:id— if it isCONNECTED, the repair worked. - Concurrent repair is impossible — there is an in-memory
repairingServerslock at the service level. A repeatPOST /repairon a server with a repair already in progress is handled correctly: the second call does not start a new procedure.
See also
- Repair the tunnel —
POST /v1/infra/servers/:id/repair— start a repair. - Get the server — check the resulting
blackholeStatus. - Refresh status — force a provider poll after the repair.
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 running but blackholeStatus is stuck in DISCONNECTED or WAITING — that is, the tunnel agent does not connect. The procedure goes through the serial console (bypassing the firewall) and includes: SSH-key injection → SSH connection → a full reinstall of the agent with the current version → waiting for reconnection. It takes up to 2 minutes; 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/execget interrupted along with their side effects (for example, an openCOPYtransaction in an external database will hang and hold its locks until that side's timeout). 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 its actual purpose: the tunnel genuinely failing 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 |
|---|---|---|
| 401 | MISSING_API_KEY |
The X-Api-Key header was not provided |
| 401 | INVALID_API_KEY |
Invalid or expired API key |
| 404 | NOT_FOUND |
The server does not exist, was deleted, or belongs to another API key |
| 409 | REPAIR_BLOCKED |
Repair blocked: preventWake=true (billing freeze, administrative block) or the server is in a special state |
| 422 | VM_MISSING |
The record has no externalId — the virtual machine was not created at the provider. Delete the server and create a new one |
| 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.
- 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.
See also
- Repair status —
GET /v1/infra/servers/:id/repair-status— progress of the current operation. - Refresh status — check whether
blackholeStatusrecovered after the repair. - Get server — check
blackholeStatusandstatus. - Reboot server — an alternative if
repairdid not help.