POST
/
projects
/
{id}
/
vpc
/
firewall-rules
Create Firewall Rule
curl --request POST \
  --url https://api.mkinf.io/v0.1/projects/{id}/vpc/firewall-rules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "mkinf-allow-tcp-udp",
  "action": "allow",
  "destinations": [
    {
      "resource_id": "75dbe735-17d6-4544-91f3-0f93c2c1c903"
    }
  ],
  "direction": "ingress",
  "protocols": [
    "tcp",
    "udp"
  ],
  "sources": [
    {
      "cidr": "0.0.0.0/0"
    }
  ],
  "vpc_network_id": "695b751c-2eaa-4e8b-8eb2-84cb367a69fe"
}'
{
  "operation": {
    "operation_id": "a8c24ef2-5b52-41b3-819c-f78f6c2fbff9",
    "state": "IN_PROGRESS",
    "metadata": {
      "operation_name": "CREATE",
      "id": "48ff2db2-3882-496f-8497-3948bc57d1a9",
      "request": {
        "name": "mkinf-allow-tcp-udp",
        "direction": "DIRECTION_INGRESS",
        "action": "ACTION_ALLOW",
        "sources": [
          {
            "cidr": "",
            "resource_id": "75dbe735-17d6-4544-91f3-0f93c2c1c903"
          }
        ],
        "source_ports": [],
        "destinations": [
          {
            "cidr": "",
            "resource_id": "75dbe735-17d6-4544-91f3-0f93c2c1c903"
          }
        ],
        "destination_ports": [],
        "protocols": [
          "tcp",
          "udp"
        ],
        "vpc_network_id": ""
      }
    },
    "result": null,
    "started_at": "2024-06-16T20:12:16Z",
    "completed_at": ""
  }
}
Create a new firewall rule in a project.

Required Parameters

  • name: Rule name
  • action: “allow” or “deny”
  • direction: “ingress” or “egress”
  • vpc_network_id: Network ID
  • sources: Source specifications
  • destinations: Destination specifications
  • protocols: Protocol list (e.g., “tcp”, “udp”)

Optional Parameters

  • source_ports: Source port ranges
  • destination_ports: Destination port ranges

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

Project id

Body

application/json

Response

200 - application/json

The response is of type object.