> ## 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.

# Create PTY session

> Create a new pseudo-terminal (PTY) session for running shell commands and processes.



## OpenAPI

````yaml /openapi.json post /pty
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /pty:
    post:
      summary: Create PTY session
      description: >-
        Create a new pseudo-terminal (PTY) session for running shell commands
        and processes.
      operationId: pty.create
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                command:
                  type: string
                args:
                  type: array
                  items:
                    type: string
                cwd:
                  type: string
                title:
                  type: string
                env:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: string
      responses:
        '200':
          description: Created session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pty'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.pty.create({
              ...
            })
components:
  schemas:
    Pty:
      type: object
      properties:
        id:
          type: string
          pattern: ^pty.*
        title:
          type: string
        command:
          type: string
        args:
          type: array
          items:
            type: string
        cwd:
          type: string
        status:
          type: string
          enum:
            - running
            - exited
        pid:
          type: number
      required:
        - id
        - title
        - command
        - args
        - cwd
        - status
        - pid
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success

````

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