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

# Connect

> Server-streaming RPC. Use the Connect protocol with streaming support.



## OpenAPI

````yaml /openapi-public.yml post /process.Process/Connect
openapi: 3.1.0
info:
  title: E2B API
  version: 0.1.0
  description: >-
    Complete E2B developer API. Platform endpoints are served on api.e2b.app.
    Sandbox endpoints (envd) are served on the shared sandbox host
    (sandbox.e2b.app); target a specific sandbox with the E2b-Sandbox-Id and
    E2b-Sandbox-Port headers.
servers:
  - url: https://api.e2b.app
    description: E2B Platform API
security: []
tags:
  - name: Sandboxes
  - name: Templates
  - name: Tags
  - name: Volumes
  - name: Envd
  - name: Filesystem
  - name: Process
  - name: Teams
paths:
  /process.Process/Connect:
    servers:
      - url: https://sandbox.{domain}
        description: Sandbox API (envd) - runs inside each sandbox
        variables:
          domain:
            default: e2b.app
            description: E2B domain
    post:
      tags:
        - Process
      summary: Connect
      description: Server-streaming RPC. Use the Connect protocol with streaming support.
      operationId: process.Process.Connect
      parameters:
        - name: Connect-Protocol-Version
          in: header
          required: true
          schema:
            $ref: '#/components/schemas/connect-protocol-version'
        - name: Connect-Timeout-Ms
          in: header
          schema:
            $ref: '#/components/schemas/connect-timeout-header'
        - name: E2b-Sandbox-Id
          in: header
          required: true
          description: >-
            Identifier of the target sandbox. Routes the request to that
            sandbox's envd over the shared sandbox host.
          schema:
            type: string
        - name: E2b-Sandbox-Port
          in: header
          required: true
          description: Port envd listens on inside the sandbox (default 49983).
          schema:
            type: integer
            default: 49983
      requestBody:
        content:
          application/connect+json:
            schema:
              $ref: '#/components/schemas/process.ConnectRequest'
        required: true
      responses:
        '200':
          description: Stream of ConnectResponse events
          content:
            application/connect+json:
              schema:
                $ref: '#/components/schemas/process.ConnectResponse'
        '502':
          description: Sandbox not found
          content:
            application/json:
              schema:
                type: object
                required:
                  - sandboxID
                  - message
                  - code
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: integer
                    description: Error code
                  sandboxID:
                    type: string
                    description: Identifier of the sandbox
      security:
        - SandboxAccessTokenAuth: []
components:
  schemas:
    connect-protocol-version:
      type: number
      title: Connect-Protocol-Version
      description: Define the version of the Connect protocol
      const: 1
    connect-timeout-header:
      type: number
      title: Connect-Timeout-Ms
      description: Define the timeout, in ms
    process.ConnectRequest:
      type: object
      properties:
        process:
          $ref: '#/components/schemas/process.ProcessSelector'
          title: process
      title: ConnectRequest
      additionalProperties: false
    process.ConnectResponse:
      type: object
      properties:
        event:
          $ref: '#/components/schemas/process.ProcessEvent'
          title: event
      title: ConnectResponse
      additionalProperties: false
    process.ProcessSelector:
      type: object
      oneOf:
        - properties:
            pid:
              type: integer
              title: pid
          title: pid
          required:
            - pid
        - properties:
            tag:
              type: string
              title: tag
          title: tag
          required:
            - tag
      title: ProcessSelector
      additionalProperties: false
    process.ProcessEvent:
      type: object
      oneOf:
        - properties:
            data:
              $ref: '#/components/schemas/process.ProcessEvent.DataEvent'
              title: data
          title: data
          required:
            - data
        - properties:
            end:
              $ref: '#/components/schemas/process.ProcessEvent.EndEvent'
              title: end
          title: end
          required:
            - end
        - properties:
            keepalive:
              $ref: '#/components/schemas/process.ProcessEvent.KeepAlive'
              title: keepalive
          title: keepalive
          required:
            - keepalive
        - properties:
            start:
              $ref: '#/components/schemas/process.ProcessEvent.StartEvent'
              title: start
          title: start
          required:
            - start
      title: ProcessEvent
      additionalProperties: false
    process.ProcessEvent.DataEvent:
      type: object
      oneOf:
        - properties:
            pty:
              type: string
              title: pty
              format: byte
          title: pty
          required:
            - pty
        - properties:
            stderr:
              type: string
              title: stderr
              format: byte
          title: stderr
          required:
            - stderr
        - properties:
            stdout:
              type: string
              title: stdout
              format: byte
          title: stdout
          required:
            - stdout
      title: DataEvent
      additionalProperties: false
    process.ProcessEvent.EndEvent:
      type: object
      properties:
        exitCode:
          type: integer
          title: exit_code
          format: int32
          deprecated: true
          description: >-
            Deprecated: not populated by the server. Parse the exit code from
            the `status` string (e.g. "exit status 0").
        exited:
          type: boolean
          title: exited
        status:
          type: string
          title: status
          description: >-
            Process exit status string (e.g. "exit status 0"). Parse the integer
            exit code from this field.
        error:
          type:
            - string
            - 'null'
          title: error
      title: EndEvent
      additionalProperties: false
    process.ProcessEvent.KeepAlive:
      type: object
      title: KeepAlive
      additionalProperties: false
    process.ProcessEvent.StartEvent:
      type: object
      properties:
        pid:
          type: integer
          title: pid
      title: StartEvent
      additionalProperties: false
  securitySchemes:
    SandboxAccessTokenAuth:
      type: apiKey
      in: header
      name: X-Access-Token
      description: >-
        Sandbox access token (`envdAccessToken`) for authenticating requests to
        a running sandbox. Returned by: [POST
        /sandboxes](/docs/api-reference/sandboxes/create-a-sandbox) (on create),
        [POST
        /sandboxes/{sandboxID}/connect](/docs/api-reference/sandboxes/connect-to-a-sandbox)
        (on connect), [POST
        /sandboxes/{sandboxID}/resume](/docs/api-reference/sandboxes/resume-a-sandbox)
        (on resume), and [GET
        /sandboxes/{sandboxID}](/docs/api-reference/sandboxes/get-a-sandbox)
        (for running or paused sandboxes).

````