Skip to main content
POST
/
api
/
v1
/
pty
Create a PTY session
curl --request POST \
  --url https://{sandbox_id_or_name}.sandbox.tensorlake.ai/api/v1/pty \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "command": "<string>",
  "args": [
    "<string>"
  ],
  "env": {},
  "working_dir": "<string>",
  "rows": 123,
  "cols": 123
}
'
{
  "session_id": "<string>",
  "token": "<string>"
}
Create a PTY session for interactive terminal access.

Endpoint

POST /api/v1/pty
Use this endpoint on the sandbox proxy host:
https://<sandbox-id-or-name>.sandbox.tensorlake.ai/api/v1/pty

Example Request

curl -X POST https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/pty \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "/bin/bash",
    "args": ["-l"],
    "env": {"TERM": "xterm-256color"},
    "working_dir": "/workspace",
    "rows": 24,
    "cols": 80
  }'

Request Body

{
  "command": "/bin/bash",
  "args": ["-l"],
  "env": {"TERM": "xterm-256color"},
  "working_dir": "/workspace",
  "rows": 24,
  "cols": 80
}
  • command is required.
  • args is optional.
  • env is optional.
  • working_dir is optional.
  • rows and cols are optional and default to 24 and 80.
  • Tensorlake clamps rows to 1..500 and cols to 1..1000.

Response

Tensorlake returns 201 Created:
{
  "session_id": "LYtJOrxE9Kz3bphPUDzuX",
  "token": "<pty-session-token>"
}
Use session_id with the other PTY endpoints. Use token when connecting to the PTY WebSocket. If the sandbox already has 64 PTY sessions, Tensorlake returns 429 Too Many Requests with code TOO_MANY_SESSIONS.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
command
string
required
args
string[]
env
object
working_dir
string
rows
integer<int32>
cols
integer<int32>

Response

PTY session created successfully

session_id
string
required
token
string
required