> ## 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 floating IP

> This endpoint updates the association and tags of an existing Floating IP. The behavior depends on
the current association state and the provided fields:

Parameters:

`port_id`: The unique identifier of the network interface (port) to which the Floating IP should be assigned.
This ID can be retrieved from the "Get instance" or "List network interfaces" endpoints.

`fixed_ip_address`: The private IP address assigned to the network interface.
This must be one of the IP addresses currently assigned to the specified port.
You can retrieve available fixed IP addresses from the "Get instance" or
"List network interfaces" endpoints.

When the Floating IP has no port associated (`port_id` is null):
- Patch with both `port_id` and `fixed_ip_address`:
Assign the Floating IP to the specified port and the provided `fixed_ip_address`, if that
`fixed_ip_address` exists on the port and is not yet used by another Floating IP.
- Patch with `port_id` only (`fixed_ip_address` omitted):
Assign the Floating IP to the specified port using the first available IPv4 fixed IP of that port.

When the Floating IP is already associated with a port:
- Patch with both `port_id` and `fixed_ip_address`:
Re-assign the Floating IP to the specified port and address if all validations pass.
- Patch with `port_id` only (`fixed_ip_address` omitted):
Re-assign the Floating IP to the specified port using the first available IPv4 fixed IP of that port.
- Patch with `port_id` = null:
Unassign the Floating IP from its current port.

Tags:
- You can update tags alongside association changes. Tags are provided as a list of key-value pairs.

Idempotency and task creation:
- No worker task is created if the requested state is already actual, i.e., the requested `port_id`
equals the current `port_id` and/or the requested `fixed_ip_address` equals the current `fixed_ip_address`,
and the tags already match the current tags. In such cases, the endpoint returns an empty tasks list.



## OpenAPI

````yaml /api-reference/services_documented/cloud_api.yaml patch /cloud/v2/floatingips/{project_id}/{region_id}/{floating_ip_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: '2026-05-15T06:37:28.230198+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Bare Metal
    x-displayName: Bare Metal
  - name: Container as a Service
    x-displayName: Container as a Service
  - name: Cost Reports
    x-displayName: Cost Reports
  - name: DDoS Protection
    x-displayName: DDoS Protection
  - name: Everywhere Inference
    x-displayName: Everywhere Inference
  - name: Everywhere Inference Apps
    x-displayName: Everywhere Inference Apps
  - name: File Shares
    x-displayName: File Shares
  - name: Floating IPs
    x-displayName: Floating IPs
  - name: Function as a Service
    x-displayName: Function as a Service
  - name: GPU Bare Metal
    x-displayName: GPU Bare Metal
  - name: GPU Virtual
    x-displayName: GPU Virtual
  - name: IP Ranges
    x-displayName: IP Ranges
  - name: Images
    x-displayName: Images
  - name: Instances
    x-displayName: Instances
  - name: Load Balancers
    x-displayName: Load Balancers
  - name: Logging
    x-displayName: Logging
  - name: Managed Kubernetes
    x-displayName: Managed Kubernetes
  - name: Managed PostgreSQL
    x-displayName: Managed PostgreSQL
  - name: Networks
    x-displayName: Networks
  - name: Placement Groups
    x-displayName: Placement Groups
  - name: Projects
    x-displayName: Projects
  - name: Quotas
    x-displayName: Quotas
  - name: Regions
    x-displayName: Regions
  - name: Registry
    x-displayName: Registry
  - name: Reservations
    x-displayName: Reservations
  - name: Reserved IPs
    x-displayName: Reserved IPs
  - name: Routers
    x-displayName: Routers
  - name: SSH Keys
    x-displayName: SSH Keys
  - name: Secrets
    x-displayName: Secrets
  - name: Security Groups
    x-displayName: Security Groups
  - name: Snapshot Schedules
    x-displayName: Snapshot Schedules
  - name: Snapshots
    x-displayName: Snapshots
  - name: Tasks
    x-displayName: Tasks
  - name: User Actions
    x-displayName: User Actions
  - name: User Role Assignments
    x-displayName: User Role Assignments
  - name: Volumes
    x-displayName: Volumes
paths:
  /cloud/v2/floatingips/{project_id}/{region_id}/{floating_ip_id}:
    patch:
      tags:
        - Floating IPs
      summary: Update floating IP
      description: >-
        This endpoint updates the association and tags of an existing Floating
        IP. The behavior depends on

        the current association state and the provided fields:


        Parameters:


        `port_id`: The unique identifier of the network interface (port) to
        which the Floating IP should be assigned.

        This ID can be retrieved from the "Get instance" or "List network
        interfaces" endpoints.


        `fixed_ip_address`: The private IP address assigned to the network
        interface.

        This must be one of the IP addresses currently assigned to the specified
        port.

        You can retrieve available fixed IP addresses from the "Get instance" or

        "List network interfaces" endpoints.


        When the Floating IP has no port associated (`port_id` is null):

        - Patch with both `port_id` and `fixed_ip_address`:

        Assign the Floating IP to the specified port and the provided
        `fixed_ip_address`, if that

        `fixed_ip_address` exists on the port and is not yet used by another
        Floating IP.

        - Patch with `port_id` only (`fixed_ip_address` omitted):

        Assign the Floating IP to the specified port using the first available
        IPv4 fixed IP of that port.


        When the Floating IP is already associated with a port:

        - Patch with both `port_id` and `fixed_ip_address`:

        Re-assign the Floating IP to the specified port and address if all
        validations pass.

        - Patch with `port_id` only (`fixed_ip_address` omitted):

        Re-assign the Floating IP to the specified port using the first
        available IPv4 fixed IP of that port.

        - Patch with `port_id` = null:

        Unassign the Floating IP from its current port.


        Tags:

        - You can update tags alongside association changes. Tags are provided
        as a list of key-value pairs.


        Idempotency and task creation:

        - No worker task is created if the requested state is already actual,
        i.e., the requested `port_id`

        equals the current `port_id` and/or the requested `fixed_ip_address`
        equals the current `fixed_ip_address`,

        and the tags already match the current tags. In such cases, the endpoint
        returns an empty tasks list.
      operationId: FloatingIPInstanceViewSetV2.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: floating_ip_id
          required: true
          description: Floating IP ID
          schema:
            description: Floating IP ID
            example: c64e5db1-5f1f-43ec-a8d9-5090df85b82d
            examples:
              - c64e5db1-5f1f-43ec-a8d9-5090df85b82d
            format: uuid4
            title: Floating Ip Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchFloatingIPV2Serializer'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIDsSerializer'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            task_id_list = client.cloud.floating_ips.update(
                floating_ip_id="c64e5db1-5f1f-43ec-a8d9-5090df85b82d",
                project_id=1,
                region_id=1,
            )
            print(task_id_list.tasks)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/cloud\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttaskIDList, err := client.Cloud.FloatingIPs.Update(\n\t\tcontext.TODO(),\n\t\t\"c64e5db1-5f1f-43ec-a8d9-5090df85b82d\",\n\t\tcloud.FloatingIPUpdateParams{\n\t\t\tProjectID: gcore.Int(1),\n\t\t\tRegionID:  gcore.Int(1),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", taskIDList.Tasks)\n}\n"
components:
  schemas:
    PatchFloatingIPV2Serializer:
      properties:
        fixed_ip_address:
          anyOf:
            - format: ipv4
              type: string
            - type: 'null'
          description: Fixed IP address
          examples:
            - 192.168.10.15
          title: Fixed Ip Address
        port_id:
          anyOf:
            - format: uuid4
              type: string
            - type: 'null'
          description: Port ID
          examples:
            - ee2402d0-f0cd-4503-9b75-69be1d11c5f1
          title: Port Id
        tags:
          anyOf:
            - $ref: '#/components/schemas/UpdateTagsSerializer'
            - type: 'null'
          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: PatchFloatingIPV2Serializer
      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
    UpdateTagsSerializer:
      patternProperties:
        ^[^\s=]+$:
          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. Set to `null` in order to
            delete this tag.
          examples:
            - my-tag-value
      propertyNames:
        description: >-
          Tag key. Maximum 255 characters. Cannot contain spaces, tabs,
          newlines, empty string or '=' character.
        examples:
          - my-tag
        maxLength: 255
        minLength: 1
      title: UpdateTagsSerializer
      type: object
  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

````