Skip to main content
POST
/
cloud
/
v2
/
security_groups
/
{project_id}
/
{region_id}
Create security group
curl --request POST \
  --url https://api.gcore.com/cloud/v2/security_groups/{project_id}/{region_id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "rules": [
    {
      "direction": "egress",
      "description": "<string>",
      "ethertype": "IPv4",
      "port_range_max": 80,
      "port_range_min": 80,
      "protocol": "ah",
      "remote_group_id": "<string>",
      "remote_ip_prefix": "10.0.0.0/8"
    }
  ],
  "tags": {}
}
'
{
  "tasks": [
    "<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

Example:

1

region_id
integer
required

Region ID

Example:

1

Body

application/json
name
string
required

Security group name

Example:

"my_security_group"

description
string

Security group description

Example:

"My security group description"

rules
CreateSecurityGroupRuleSerializer · object[]

Security group rules

tags
CreateTagsSerializer · object

Key-value tags to associate 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. Both tag keys and values have a maximum length of 255 characters. 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.

Example:
{ "my-tag": "my-tag-value" }

Response

200 - application/json

OK

tasks
string[]
required

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"]