Delete Code Contexts by Language
DELETE
/v1/sandbox/{sandbox_id}/code/contextsDELETE
/v1/sandbox/{'{sandbox_id}'}/code/contextsYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Description
Deletes all code execution contexts associated with a specific language within a sandbox. Useful for clearing all Python, JavaScript, or other language contexts in bulk without having to delete them one by one.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sandbox_id | string | Yes | Sandbox ID or name |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
language | string | Yes | The programming language whose contexts should be deleted (e.g., python, javascript) |
Responses
200 Success
| Property | Type | Description |
|---|---|---|
deleted | integer | The number of contexts that were deleted |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X DELETE "https://your-instance.example.com/v1/sandbox/sb_abc123/code/contexts?language=python" \
-H "Authorization: Bearer <token>"const response = await fetch(
"https://your-instance.example.com/v1/sandbox/sb_abc123/code/contexts?language=python",
{
method: "DELETE",
headers: {
Authorization: "Bearer <token>",
},
}
);
const data = await response.json();
console.log(data); // { deleted: 2 }import requests
response = requests.delete(
"https://your-instance.example.com/v1/sandbox/sb_abc123/code/contexts",
params={"language": "python"},
headers={"Authorization": "Bearer <token>"},
)
print(response.json()) # {"deleted": 2}Response
{"deleted": 2}{"code": 0, "message": "string", "details": [{"@type": "string"}]}
