Everstack
API ReferenceSandboxDelete Code Contexts

Delete Code Contexts by Language

DELETE/v1/sandbox/{sandbox_id}/code/contexts
DELETE/v1/sandbox/{'{sandbox_id}'}/code/contexts

Your 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

ParameterTypeRequiredDescription
sandbox_idstringYesSandbox ID or name

Query Parameters

ParameterTypeRequiredDescription
languagestringYesThe programming language whose contexts should be deleted (e.g., python, javascript)

Responses

200 Success

PropertyTypeDescription
deletedintegerThe number of contexts that were deleted

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

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"}]}