Skip to main content

Code Sessions

Create and drive interactive coding workspaces backed by a PTY sidecar (the Claude Code workspace feature). Each session exposes a terminal you can send input to and poll output from, and can be deployed as an application when the project is ready.

All endpoints require authentication via X-API-Key header and the appropriate scope.


Code Session Object

{
"id": "cs_abc123",
"projectName": "marketing-site",
"projectDescription": "Static marketing landing page with blog",
"status": "running",
"workspaceId": "ws_abc123",
"ptyEndpoint": "https://pty.strongly.ai/cs_abc123",
"userId": "user_456",
"organizationId": "org_xyz",
"createdAt": "2025-02-01T14:22:00Z",
"updatedAt": "2025-02-01T14:25:00Z"
}

POST /api/v1/code-sessions

Create a new code session. Provisions a workspace and PTY sidecar for interactive coding.

Scope: code-sessions:write

Request Body

{
"projectName": "marketing-site",
"projectDescription": "Static marketing landing page with blog"
}
FieldTypeRequiredDescription
projectNamestringYesName of the project
projectDescriptionstringYesDescription of the project

Response 201 Created

{
"sessionId": "cs_abc123",
"workspaceId": "ws_abc123",
"status": "creating"
}

GET /api/v1/code-sessions/:id

Get details of a code session including status, workspace info, and metadata.

Scope: code-sessions:read

Path Parameters

ParameterTypeRequiredDescription
idstringYesCode session ID

Response 200 OK

{
"id": "cs_abc123",
"projectName": "marketing-site",
"status": "running",
"workspaceId": "ws_abc123",
"ptyEndpoint": "https://pty.strongly.ai/cs_abc123",
"createdAt": "2025-02-01T14:22:00Z",
"updatedAt": "2025-02-01T14:25:00Z"
}

POST /api/v1/code-sessions/:id/input

Send text input to the code session's PTY (terminal). Use this to execute commands or provide input to a running prompt.

Scope: code-sessions:write

Path Parameters

ParameterTypeRequiredDescription
idstringYesCode session ID

Request Body

{
"text": "ls -la\n"
}
FieldTypeRequiredDescription
textstringYesText to send to the terminal (include \n to submit)

Response 200 OK

{
"sent": true,
"bytes": 7
}

GET /api/v1/code-sessions/:id/output

Get terminal output from a code session. Use afterSeq to poll for new output since the last read.

Scope: code-sessions:read

Path Parameters

ParameterTypeRequiredDescription
idstringYesCode session ID

Query Parameters

ParameterTypeRequiredDescription
afterSeqintegerNoOnly return output chunks after this sequence number (for polling)

Response 200 OK

{
"sessionId": "cs_abc123",
"chunks": [
{ "seq": 12, "text": "total 24\n", "createdAt": "2025-02-01T14:25:01Z" },
{ "seq": 13, "text": "drwxr-xr-x 5 root root 160 Feb 1 14:25 .\n", "createdAt": "2025-02-01T14:25:01Z" }
],
"lastSeq": 13
}

POST /api/v1/code-sessions/:id/deploy

Deploy the code session workspace as an application. Triggers the zip, build, and deploy pipeline.

Scope: code-sessions:deploy

Path Parameters

ParameterTypeRequiredDescription
idstringYesCode session ID

Response 200 OK

{
"sessionId": "cs_abc123",
"appId": "app_def456",
"status": "deploying"
}

DELETE /api/v1/code-sessions/:id

End a code session. Stops the workspace and marks the session as completed.

Scope: code-sessions:write

Path Parameters

ParameterTypeRequiredDescription
idstringYesCode session ID

Response 204 No Content