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

# Update port

> Update port security settings, allowed address pairs, and/or security groups.

Supported for:
- Virtual machine instance ports
- Bare metal instance ports with software-defined networking (SmartNIC/DPU)

Not supported for standard bare metal ports.



## OpenAPI

````yaml /api-reference/services_docs_mintlify/cloud_api.yaml patch /cloud/v1/ports/{project_id}/{region_id}/{port_id}
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Cloud API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: 2e769ad691db
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Bare Metal
  - name: Container as a Service
  - name: Cost Reports
  - name: DDoS Protection
  - name: Everywhere Inference
  - name: Everywhere Inference Apps
  - name: File Shares
  - name: Floating IPs
  - name: Function as a Service
  - name: GPU Bare Metal
  - name: GPU Virtual
  - name: IP Ranges
  - name: Images
  - name: Instances
  - name: Load Balancers
  - name: Logging
  - name: Managed Kubernetes
  - name: Managed PostgreSQL
  - name: Networks
  - name: Placement Groups
  - name: Ports
  - name: Projects
  - name: Quotas
  - name: Regions
  - name: Registry
  - name: Reservations
  - name: Reserved IPs
  - name: Routers
  - name: SSH Keys
  - name: Secrets
  - name: Security Groups
  - name: Snapshot Schedules
  - name: Snapshots
  - name: Tasks
  - name: User Actions
  - name: User Role Assignments
  - name: Volumes
paths:
  /cloud/v1/ports/{project_id}/{region_id}/{port_id}:
    patch:
      tags:
        - Ports
      summary: Update port
      description: >-
        Update port security settings, allowed address pairs, and/or security
        groups.


        Supported for:

        - Virtual machine instance ports

        - Bare metal instance ports with software-defined networking
        (SmartNIC/DPU)


        Not supported for standard bare metal ports.
      operationId: PortDetailView.patch
      parameters:
        - in: path
          name: project_id
          required: true
          description: Project ID
          schema:
            description: Project ID
            example: 1
            examples:
              - 1
            title: Project Id
            type: integer
        - in: path
          name: region_id
          required: true
          description: Region ID
          schema:
            description: Region ID
            example: 1
            examples:
              - 1
            title: Region Id
            type: integer
        - in: path
          name: port_id
          required: true
          description: Port ID
          schema:
            description: Port ID
            example: 1f0ca628-a73b-42c0-bdac-7b10d023e097
            examples:
              - 1f0ca628-a73b-42c0-bdac-7b10d023e097
            format: uuid4
            title: Port Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchPortSerializer'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIDsSerializer'
components:
  schemas:
    PatchPortSerializer:
      properties:
        allowed_address_pairs:
          description: >-
            A set of zero or more allowed port address pair and/or subnet masks.
            Replaces the full set of allowed address pairs. Send `[]` to clear;
            omit the field to leave existing pairs unchanged.
          example:
            - ip_address: 192.168.123.20
            - ip_address: 192.168.0.0/17
          examples:
            - - ip_address: 192.168.123.20
              - ip_address: 192.168.0.0/17
          items:
            $ref: '#/components/schemas/PatchAllowedAddressPairsSerializer'
          maxItems: 10
          title: Allowed Address Pairs
          type: array
        ip_assignments:
          description: >-
            IP assignments on the port. Replaces the full set; subnets must
            belong to the port's network and at least one assignment must
            remain. The IP address is required (server-picked allocation is
            reserved for port creation).
          items:
            $ref: '#/components/schemas/IpAssignmentRequestSerializer'
          title: Ip Assignments
          type: array
        port_security_enabled:
          description: >-
            When true, the network driver enforces port security on this port
            (anti-spoofing checks and security-group filtering apply). When
            false, all traffic is allowed and security groups are not applied.
          title: Port Security Enabled
          type: boolean
        security_group_ids:
          description: >-
            List of security group IDs. Replaces the full set of security groups
            attached to the port. Send `[]` to detach all groups; omit the field
            to leave existing groups unchanged.
          example:
            - 351b0dd7-ca09-431c-be53-935db3785067
          examples:
            - - 351b0dd7-ca09-431c-be53-935db3785067
          items:
            format: uuid4
            type: string
          maxItems: 10
          title: Security Group Ids
          type: array
        tags:
          $ref: '#/components/schemas/UpdateTagsSerializer'
          description: >-
            Update key-value tags using JSON Merge Patch semantics (RFC 7386).
            Provide key-value pairs to add or update tags. Set tag values to
            `null` to remove tags. Unspecified tags remain unchanged. Read-only
            tags are always preserved and cannot be modified.


            **Examples:**


            - **Add/update tags:** `{'tags': {'environment': 'production',
            'team': 'backend'}}` adds new tags or updates existing ones.

            - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific
            tags.

            - **Remove all tags:** `{'tags': null}` removes all user-managed
            tags (read-only tags are preserved).

            - **Partial update:** `{'tags': {'environment': 'staging'}}` only
            updates specified tags.

            - **Mixed operations:** `{'tags': {'environment': 'production',
            'cost_center': 'engineering', 'deprecated_tag': null}}` adds/updates
            'environment' and 'cost_center' while removing 'deprecated_tag',
            preserving other existing tags.

            - **Replace all:** first delete existing tags with null values, then
            add new ones in the same request.
          examples:
            - my-tag: my-tag-value
              my-tag-to-remove: null
      title: PatchPortSerializer
      type: object
    TaskIDsSerializer:
      properties:
        tasks:
          description: >-
            List of task IDs representing asynchronous operations. Use these IDs
            to monitor operation progress:

            - `GET /v1/tasks/{task_id}` - Check individual task status and
            details

            Poll task status until completion (`FINISHED`/`ERROR`) before
            proceeding with dependent operations.
          example:
            - d478ae29-dedc-4869-82f0-96104425f565
          examples:
            - - d478ae29-dedc-4869-82f0-96104425f565
          items:
            type: string
          title: Tasks
          type: array
      required:
        - tasks
      title: TaskIDsSerializer
      type: object
    PatchAllowedAddressPairsSerializer:
      properties:
        ip_address:
          anyOf:
            - format: ipvanyaddress
              type: string
            - format: ipvanynetwork
              type: string
          description: IP address or subnet of the allowed address pair
          title: Ip Address
      required:
        - ip_address
      title: PatchAllowedAddressPairsSerializer
      type: object
    IpAssignmentRequestSerializer:
      properties:
        ip_address:
          anyOf:
            - format: ipv4
              type: string
            - format: ipv6
              type: string
          description: IP address to assign
          title: Ip Address
        subnet_id:
          description: ID of the subnet
          format: uuid4
          title: Subnet Id
          type: string
      required:
        - subnet_id
        - ip_address
      title: IpAssignmentRequestSerializer
      type: object
    UpdateTagsSerializer:
      propertyNames:
        description: >-
          Tag key. Maximum 255 characters. Cannot contain spaces, tabs,
          newlines, empty string or '=' character. Trailing or leading
          whitespaces will be stripped.
        examples:
          - my-tag
        maxLength: 255
        minLength: 1
        pattern: ^[^\s=]+$
      title: UpdateTagsSerializer
      type: object
      additionalProperties:
        anyOf:
          - maxLength: 255
            minLength: 1
            pattern: ^[^ \t\n\r\f\v]([^\t\n\r\f\v]*[^ \t\n\r\f\v])?$
            type: string
          - type: 'null'
        description: >-
          Tag value. Maximum 255 characters. Cannot contain tabs, newlines,
          empty string or start/end with whitespace. Trailing or leading
          whitespaces will be stripped. Set to `null` in order to delete this
          tag.
        examples:
          - my-tag-value
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````