Kill a sandbox to forcefully terminate it immediately. This is similar to delete but may be used when a sandbox is unresponsive. The sandbox is destroyed and cannot be recovered.
Endpoint
POST /v1/sandboxes/:id/kill
Request
Authorization: Bearer $HOPX_API_KEY
Path Parameters
| Parameter | Type | Description |
|---|
id | string | Sandbox ID to kill |
Example Request
curl -X POST https://api.hopx.dev/v1/sandboxes/sandbox_abc123xyz/kill \
-H "Authorization: Bearer $HOPX_API_KEY"
Response
Success (200 OK)
{
"id": "sandbox_abc123xyz",
"status": "killed",
"request_id": "req_abc123"
}
Response Fields
| Field | Type | Description |
|---|
id | string | Sandbox ID |
status | string | New status (killed) |
request_id | string | Request ID for debugging |
Status Codes
| Code | Description |
|---|
200 | Sandbox killed successfully |
401 | Authentication required |
404 | Sandbox not found |
Errors
Sandbox Not Found (404)
{
"error": "Sandbox not found",
"code": "RESOURCE_NOT_FOUND",
"request_id": "req_abc123"
}
Cause: The sandbox ID doesn’t exist or belongs to another organization.
Fix: Verify the sandbox ID is correct. List your sandboxes using GET /v1/sandboxes to find valid IDs.
Important Notes
Killing a sandbox is permanent and irreversible. All data, files, and state in the sandbox will be lost. This action forcefully terminates the sandbox even if it’s unresponsive.
- Immediate termination - The sandbox is forcefully terminated immediately
- No graceful shutdown - Running processes are killed without cleanup
- Resource cleanup - All allocated resources are freed
- VM Agent API - The sandbox’s VM Agent API endpoint becomes unavailable immediately
- No recovery - Killed sandboxes cannot be recovered
Use Cases
Kill Unresponsive Sandbox
# Kill a sandbox that's not responding
curl -X POST https://api.hopx.dev/v1/sandboxes/sandbox_abc123xyz/kill \
-H "Authorization: Bearer $HOPX_API_KEY"
Force Cleanup
# Kill instead of delete when sandbox is stuck
curl -X POST https://api.hopx.dev/v1/sandboxes/sandbox_abc123xyz/kill \
-H "Authorization: Bearer $HOPX_API_KEY"
Difference from Delete
- Kill - Forcefully terminates the sandbox immediately, even if unresponsive
- Delete - Gracefully deletes the sandbox (may fail if sandbox is stuck)
Use kill when a sandbox is unresponsive and delete doesn’t work.
Next Steps