Skip to main content
PATCH
/
cloud
/
v1
/
instances
/
{project_id}
/
{region_id}
/
{instance_id}
Python
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
instance = client.cloud.instances.update(
    instance_id="instance_id",
    project_id=0,
    region_id=0,
)
print(instance.id)
{
  "addresses": {},
  "blackhole_ports": [
    {
      "AlarmEnd": "2023-11-07T05:31:56Z",
      "AlarmStart": "2023-11-07T05:31:56Z",
      "AlarmState": "ACK_REQ",
      "AlertDuration": "<string>",
      "DestinationIP": "<string>",
      "ID": 123
    }
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "creator_task_id": "<string>",
  "ddos_profile": {
    "fields": [
      {
        "base_field": 10,
        "default": null,
        "description": "ARK server ports. Valid port values are in range 1000-65535",
        "field_name": "ARK Ports",
        "field_type": null,
        "field_value": "<unknown>",
        "id": 123,
        "name": "<string>",
        "required": true,
        "validation_schema": "<unknown>",
        "value": null
      }
    ],
    "id": 123,
    "options": {
      "active": true,
      "bgp": true
    },
    "profile_template": {
      "description": "description",
      "fields": [
        {
          "default": null,
          "description": "ARK server ports. Valid port values are in range 1000-65535",
          "field_type": null,
          "id": 123,
          "name": "<string>",
          "required": true,
          "validation_schema": "<unknown>"
        }
      ],
      "id": 123,
      "name": "<string>"
    },
    "profile_template_description": "ARK server ports. Valid port values are in range 1000-65535",
    "protocols": [
      {
        "port": "80",
        "protocols": [
          "TCP",
          "HTTP"
        ]
      },
      {
        "port": "53",
        "protocols": [
          "UDP"
        ]
      }
    ],
    "site": "ED",
    "status": {
      "error_description": "",
      "status": "Updated"
    }
  },
  "fixed_ip_assignments": [
    {
      "external": true,
      "ip_address": "<string>",
      "subnet_id": "<string>"
    }
  ],
  "flavor": {
    "architecture": "<string>",
    "flavor_id": "<string>",
    "flavor_name": "<string>",
    "hardware_description": {
      "ram": "<string>",
      "vcpus": "<string>"
    },
    "os_type": "<string>",
    "ram": 123,
    "vcpus": 123
  },
  "id": "<string>",
  "instance_description": "Instance description",
  "instance_isolation": {
    "reason": "Suspicious activities"
  },
  "name": "<string>",
  "project_id": 123,
  "region": "<string>",
  "region_id": 123,
  "security_groups": [
    {
      "name": "<string>"
    }
  ],
  "ssh_key_name": "<string>",
  "status": "ACTIVE",
  "tags": [
    {
      "key": "<string>",
      "read_only": true,
      "value": "<string>"
    }
  ],
  "task_id": null,
  "task_state": "<string>",
  "vm_state": "active",
  "volumes": [
    {
      "delete_on_termination": true,
      "id": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

region_id
integer
required

Region ID

instance_id
string<uuid4>
required

Instance ID

Body

application/json
name
string

Name

tags
UpdateTagsSerializer · object

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.

Example:
{
"my-tag": "my-tag-value",
"my-tag-to-remove": null
}

Response

200 - application/json

OK

addresses
Addresses · object
required

Map of network_name to list of addresses in that network

blackhole_ports
BlackholePortSerializer · object[]
required

IP addresses of the instances that are blackholed by DDoS mitigation system

created_at
string<date-time>
required

Datetime when instance was created

creator_task_id
string | null
required

Task that created this entity

ddos_profile
GetClientProfileSerializer · object
required

Advanced DDoS protection profile. It is always null if query parameter with_ddos=true is not set.

fixed_ip_assignments
IpAssignmentsSerializer · object[] | null
required

Fixed IP assigned to instance

flavor
Instance flavor · object
required

Flavor

  • Instance flavor
  • Bare metal flavor
  • GPU cluster flavor
id
string<uuid4>
required

Instance ID

instance_description
string | null
required

Instance description

Example:

"Instance description"

instance_isolation
IsolationSerializer · object
required

Instance isolation information

name
string
required

Instance name

project_id
integer
required

Project ID

region
string
required

Region name

region_id
integer
required

Region ID

security_groups
NameSerializerPydantic · object[]
required

Security groups

ssh_key_name
string | null
required

SSH key assigned to instance

status
enum<string>
required

Instance status

Available options:
ACTIVE,
BUILD,
DELETED,
ERROR,
HARD_REBOOT,
MIGRATING,
PASSWORD,
PAUSED,
REBOOT,
REBUILD,
RESCUE,
RESIZE,
REVERT_RESIZE,
SHELVED,
SHELVED_OFFLOADED,
SHUTOFF,
SOFT_DELETED,
SUSPENDED,
UNKNOWN,
VERIFY_RESIZE
tags
TagSerializer · object[]
required

List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.

task_id
string | null
required

The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If null, the resource is not locked.

Example:

null

task_state
string | null
required

Task state

vm_state
enum<string>
required

Virtual machine state (active)

Available options:
active,
building,
deleted,
error,
paused,
rescued,
resized,
shelved,
shelved_offloaded,
soft-deleted,
stopped,
suspended
volumes
InstanceVolumeSerializer · object[]
required

List of volumes