> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensorlake.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get PTY Session

> Retrieve metadata for a single PTY session.

Get metadata for one PTY session.

## Endpoint

```http theme={null}
GET /api/v1/pty/{session_id}
```

## Example Request

```bash theme={null}
curl https://<sandbox-id>.sandbox.tensorlake.ai/api/v1/pty/<session-id> \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY"
```

## Response

Tensorlake returns `200 OK`:

```json theme={null}
{
  "session_id": "LYtJOrxE9Kz3bphPUDzuX",
  "pid": 42,
  "command": "/bin/bash",
  "args": ["-l"],
  "rows": 24,
  "cols": 80,
  "created_at": 1710000000000,
  "ended_at": null,
  "exit_code": null,
  "is_alive": true
}
```

The PTY token is not returned from this endpoint. If the kernel OOM killer terminated the PTY process, the response includes `oom_killed: true`. If the session does not exist, Tensorlake returns `404 Not Found`.


## OpenAPI

````yaml get /api/v1/pty/{session_id}
openapi: 3.1.0
info:
  title: Tensorlake API
  description: >-
    Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
    Workflows
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.tensorlake.ai/
security:
  - bearerAuth: []
tags:
  - name: Tensorlake Cloud API
    description: >-
      Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
      Workflows
paths:
  /api/v1/pty/{session_id}:
    servers:
      - url: https://{identifier}.sandbox.tensorlake.ai
        description: >-
          Example sandbox proxy host for a specific running sandbox. For
          programmatic access, use the sandbox's `ingress_endpoint`.
        variables:
          identifier:
            default: example-sandbox
            description: The sandbox ID or sandbox name.
    parameters:
      - name: session_id
        in: path
        description: The PTY session identifier.
        required: true
        schema:
          type: string
    get:
      tags:
        - sandbox-pty
      summary: Get a PTY session
      description: Retrieve metadata for a single PTY session.
      operationId: sandbox_pty_get
      responses:
        '200':
          description: PTY session metadata
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxPtySessionInfo'
        '404':
          description: PTY session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxProxyError'
components:
  schemas:
    SandboxPtySessionInfo:
      type: object
      required:
        - session_id
        - pid
        - command
        - args
        - rows
        - cols
        - created_at
        - is_alive
      properties:
        session_id:
          type: string
        pid:
          type: integer
          format: int32
        command:
          type: string
        args:
          type: array
          items:
            type: string
        rows:
          type: integer
          format: int32
        cols:
          type: integer
          format: int32
        created_at:
          type: integer
          format: int64
        ended_at:
          type:
            - integer
            - 'null'
          format: int64
        exit_code:
          type:
            - integer
            - 'null'
          format: int32
        is_alive:
          type: boolean
        oom_killed:
          type: boolean
          description: Included only when the kernel OOM killer terminated the PTY process.
    SandboxProxyError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````