> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to PTY session

> Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.



## OpenAPI

````yaml /openapi.json get /pty/{ptyID}/connect
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /pty/{ptyID}/connect:
    get:
      summary: Connect to PTY session
      description: >-
        Establish a WebSocket connection to interact with a pseudo-terminal
        (PTY) session in real-time.
      operationId: pty.connect
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
        - in: path
          name: ptyID
          schema:
            type: string
            pattern: ^pty.*
          required: true
      responses:
        '200':
          description: Connected session
          content:
            application/json:
              schema:
                type: boolean
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.pty.connect({
              ...
            })
components:
  schemas:
    NotFoundError:
      type: object
      properties:
        name:
          type: string
          const: NotFoundError
        data:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - name
        - data

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.