Skip to main content
POST
/
v1
/
sandboxes
/
{id}
/
code
/
contexts
Create a new kernel context
import requests

url = "https://api.13-215-85-171.sslip.io/v1/sandboxes/{id}/code/contexts"

payload = {
    "language": "python3",
    "cwd": "<string>"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "id": "<string>",
  "language": "<string>",
  "cwd": "<string>"
}

Authorizations

Authorization
string
header
required

API key passed as Bearer token

Path Parameters

id
string
required

Sandbox ID (e.g. sb_a1b2c3d4)

Body

application/json
language
string
default:python3
cwd
string

Working directory for the kernel. Must be an absolute sandbox path such as /workspace/project, /tmp/notebooks, /data/notebooks, or /context/demo where present. Values are normalized before kernel startup, must resolve to an existing directory in the running sandbox, and reserved runtime paths under /workspace/.nullspace are rejected.

Response

Context created

id
string
required
language
string
required
cwd
string
required

Normalized kernel working directory for this context.