Create a new kernel context
import requests
url = "https://api.13-215-85-171.sslip.io/v1/machines/{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)curl --request POST \
--url https://api.13-215-85-171.sslip.io/v1/machines/{id}/code/contexts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"language": "python3",
"cwd": "<string>"
}
'{
"id": "<string>",
"language": "<string>",
"cwd": "<string>"
}{
"error": "<string>",
"code": "invalid_request",
"error_detail": {
"code": "unauthorized",
"message": "<string>",
"phase": "auth",
"retryable": true,
"suggested_action": "<string>",
"step_index": 123,
"attempt": 123,
"max_attempts": 123,
"cache_subject": "<string>",
"build_id": "<string>",
"request_id": "<string>",
"details": {}
},
"request_id": "<string>",
"build_id": "<string>"
}Code
Create a new kernel context
POST
/
v1
/
machines
/
{id}
/
code
/
contexts
Create a new kernel context
import requests
url = "https://api.13-215-85-171.sslip.io/v1/machines/{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)curl --request POST \
--url https://api.13-215-85-171.sslip.io/v1/machines/{id}/code/contexts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"language": "python3",
"cwd": "<string>"
}
'{
"id": "<string>",
"language": "<string>",
"cwd": "<string>"
}{
"error": "<string>",
"code": "invalid_request",
"error_detail": {
"code": "unauthorized",
"message": "<string>",
"phase": "auth",
"retryable": true,
"suggested_action": "<string>",
"step_index": 123,
"attempt": 123,
"max_attempts": 123,
"cache_subject": "<string>",
"build_id": "<string>",
"request_id": "<string>",
"details": {}
},
"request_id": "<string>",
"build_id": "<string>"
}Authorizations
API key passed as Bearer token
Path Parameters
Machine ID (e.g. mch_a1b2c3d4)
Body
application/json
Working directory for the kernel. Must be an absolute machine 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 machine, and reserved runtime paths under /workspace/.nullspace are rejected.