---
title: "Creates a VPC firewall rule in the project and returns the async operation."
method: POST
path: "/projects/{project_id}/networking/vpc-firewall-rules"
tags: ["VPC Firewall Rules"]
---

# Creates a VPC firewall rule in the project and returns the async operation.

`POST /projects/{project_id}/networking/vpc-firewall-rules`

## Path parameters

- `project_id` string, required

## Request body

- VPCFirewallRulesPostRequestV1
  - `action` 'allow' | 'deny', required — Action applied to traffic that matches the rule: allow or deny.
  - `destination_ports` string[] — Destination ports the rule matches. Each entry is a single port or a port range (for example, 3000-8080).
  - `destinations` FirewallRuleObject[], required — Destinations the rule matches, given as CIDR blocks or resource IDs.
    - `cidr` string — CIDR block, or an IP address that is converted to a CIDR. Mutually exclusive with resource_id.
    - `resource_id` string — ID of a VPC network, subnet, or VM. Mutually exclusive with cidr.
  - `direction` 'ingress' | 'egress', required — Direction of traffic the rule applies to: ingress (inbound) or egress (outbound).
  - `name` string, required — Name for the new firewall rule.
  - `protocols` string[], required — Network protocols the rule matches (for example, tcp, udp).
  - `source_ports` string[] — Source ports the rule matches. Each entry is a single port or a port range (for example, 3000-8080).
  - `sources` FirewallRuleObject[], required — Sources the rule matches, given as CIDR blocks or resource IDs.
    - `cidr` string — CIDR block, or an IP address that is converted to a CIDR. Mutually exclusive with resource_id.
    - `resource_id` string — ID of a VPC network, subnet, or VM. Mutually exclusive with cidr.
  - `vpc_network_id` string, required — ID of the VPC network to create the rule in.

## Response `200`

- AsyncOperationResponse
  - `operation` Operation, required — Individual resources that use Operations should populate the `metadata` field with resource-specific information.
    - `completed_at` string, required
    - `metadata` string, required
    - `operation_id` string, required
    - `result` string
    - `started_at` string, required
    - `state` 'IN_PROGRESS' | 'SUCCEEDED' | 'FAILED', required

## Other responses

- `400` — Error Bad Request
- `401` — Error Authentication Failed
- `403` — Error Permissions
- `500` — Error Internal Server

---

[API](https://skmtc.net/crusoecloud/apis/crusoe-cloud-api-gateway.md) · [All operations](https://skmtc.net/crusoecloud/apis/crusoe-cloud-api-gateway/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/crusoecloud/crusoe-cloud-api-gateway/revisions/a3fd2dedc72b/schema)
