Skip to main content
POST
/
cloud
/
v2
/
security_groups
/
{project_id}
/
{region_id}
/
{group_id}
/
rules
Create security group rule
curl --request POST \
  --url https://api.gcore.com/cloud/v2/security_groups/{project_id}/{region_id}/{group_id}/rules \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "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"
}
'
{
  "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

group_id
string<uuid4>
required

Security group ID

Example:

"00000000-0000-4000-8000-000000000000"

Body

application/json
direction
enum<string>
required

Ingress or egress, which is the direction in which the security group is applied

Available options:
egress,
ingress
Example:

"ingress"

description
string

Rule description

Maximum string length: 255
Example:

"Some description"

ethertype
enum<string>

Ether type

Available options:
IPv4,
IPv6
Example:

"IPv4"

port_range_max
integer | null

The maximum port number in the range that is matched by the security group rule

Required range: 0 <= x <= 65535
Example:

80

port_range_min
integer | null

The minimum port number in the range that is matched by the security group rule

Required range: 0 <= x <= 65535
Example:

80

protocol
enum<string>

Protocol

Available options:
ah,
any,
dccp,
egp,
esp,
gre,
icmp,
igmp,
ipencap,
ipip,
ipv6-encap,
ipv6-frag,
ipv6-icmp,
ipv6-nonxt,
ipv6-opts,
ipv6-route,
ospf,
pgm,
rsvp,
sctp,
tcp,
udp,
udplite,
vrrp
Example:

"tcp"

remote_group_id
string<uuid4>

The remote group UUID to associate with this security group

Example:

"00000000-0000-4000-8000-000000000000"

remote_ip_prefix
string<ipvanynetwork> | null

The remote IP prefix that is matched by this security group rule

Example:

"10.0.0.0/8"

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