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

# Start monitoring ports for a process

> Start monitoring for new ports opened by a process



## OpenAPI

````yaml /reference/sandbox-api/openapi.json post /network/process/{pid}/monitor
openapi: 3.0.0
info:
  description: API for manipulating filesystem, processes and network.
  title: Sandbox API
  contact: {}
  version: 0.0.1
servers:
  - url: https://{sandbox_host}
    description: >-
      Host from the sandbox's returned url, without the scheme or trailing
      slash.
    variables:
      sandbox_host:
        default: sandbox.example.com
security:
  - BearerAuth: []
paths:
  /network/process/{pid}/monitor:
    post:
      tags:
        - network
      summary: Start monitoring ports for a process
      description: Start monitoring for new ports opened by a process
      parameters:
        - description: Process ID
          name: pid
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PortMonitorRequest'
        description: Port monitor configuration
        required: true
      responses:
        '200':
          description: Object containing PID and success message
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    PortMonitorRequest:
      type: object
      properties:
        callback:
          description: URL to call when a new port is detected
          type: string
          example: http://localhost:3000/callback
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Error message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Sandbox access token created through POST /v1/token.

````