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

# Atomically update forwarded HTTP ports on an instance

> Atomically add and remove forwarded HTTP ports on a running instance in a single transaction. Body: `{"add_ports": [8080], "remove_ports": [3000]}`. Adds are deduplicated and removing ports that are not currently forwarded is a no-op. Each forwarded port is reachable at https://<uuid>-<port>.thundercompute.net.



## OpenAPI

````yaml https://api.thundercompute.com:8443/openapi.json patch /instances/{id}/ports
openapi: 3.1.0
info:
  contact:
    email: support@thundercompute.com
    name: Thunder Compute API Support
    url: https://thundercompute.com/support
  description: >-
    This is the Thunder Compute API server for managing compute resources and
    GPU workloads.
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: http://swagger.io/terms/
  title: Thunder Compute API
  version: '1.0'
servers:
  - description: Production server
    url: https://api.thundercompute.com:8443/v1
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /instances/{id}/ports:
    patch:
      tags:
        - Instances
      summary: Atomically update forwarded HTTP ports on an instance
      description: >-
        Atomically add and remove forwarded HTTP ports on a running instance in
        a single transaction. Body: `{"add_ports": [8080], "remove_ports":
        [3000]}`. Adds are deduplicated and removing ports that are not
        currently forwarded is a no-op. Each forwarded port is reachable at
        https://<uuid>-<port>.thundercompute.net.
      parameters:
        - description: Instance ID (index)
          in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                - $ref: '#/components/schemas/thundertypes.PortUpdateRequest'
                  summary: request
                  description: Ports to add and remove
        description: Ports to add and remove
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.PortAddResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/thundertypes.ErrorResponse'
          description: Internal Server Error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    thundertypes.PortUpdateRequest:
      properties:
        add_ports:
          items:
            type: integer
          type: array
          uniqueItems: false
        remove_ports:
          items:
            type: integer
          type: array
          uniqueItems: false
      type: object
    thundertypes.PortAddResponse:
      properties:
        http_ports:
          items:
            type: integer
          type: array
          uniqueItems: false
        identifier:
          type: string
        instance_name:
          type: string
      required:
        - identifier
        - instance_name
      type: object
    thundertypes.ErrorResponse:
      properties:
        code:
          example: 400
          type: integer
        error:
          example: invalid_request
          type: string
        message:
          example: The request is malformed
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: >-
        Bearer token authentication. Provide your API token prefixed with
        "Bearer ", e.g. "Bearer your-api-token".
      in: header
      name: Authorization
      type: apiKey

````