> ## Documentation Index
> Fetch the complete documentation index at: https://developers.onidel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Firewall Rule

> Add a new rule to a firewall group.

Special subnet values: `Cloudflare`, `Onidel`, `HetrixTools`, `CloudFront`, `UptimeRobot`.
To reference an IP list, use `list:{ip_list_id}` as the subnet value.



## OpenAPI

````yaml /api-reference/openapi.yaml post /network/firewalls/{firewall_id}/rules
openapi: 3.0.3
info:
  title: Onidel Cloud API - OpenAPI 3.0
  description: >-
    Welcome to the **Onidel Cloud API** documentation. This API allows
    developers to seamlessly integrate with the Onidel Cloud platform, enabling
    them to manage cloud resources efficiently and securely. With our API, you
    can automate processes, retrieve detailed account information, and manage
    virtual machines (VPS), networking, storage, and more.
  termsOfService: https://docs.onidel.com/policies/terms-of-service
  contact:
    email: support@onidel.com
  version: 1.2.0
servers:
  - url: https://api.cloud.onidel.com
security: []
tags:
  - name: SSH Key
    description: Manage SSH keys for secure server access.
  - name: VPC
    description: Manage Virtual Private Cloud (VPC) networks for isolated networking.
  - name: Firewall
    description: Manage firewall groups for VM security.
  - name: OS Template
    description: >-
      We have a wide range of operating systems available to deploy server
      instances.
  - name: Instance Type
    description: We provide different instance types for different workload.
  - name: Startup Script
    description: >-
      Manage startup scripts that run on first boot of a server instance.
      Maximum 10 scripts per team.
  - name: IP List
    description: >-
      Manage IP lists for use in firewall rules. IP lists group multiple IP
      addresses/CIDRs together.
  - name: Firewall Rule
    description: Manage firewall rules within a firewall group.
  - name: Object Storage
    description: Manage S3-compatible object storage services, buckets, and access keys.
  - name: Custom ISO
    description: Manage custom ISO images that can be used to boot server instances (BYOI).
  - name: Measured Boot Image
    description: >-
      Manage SEV-SNP measured direct boot images (UKIs) and attach/detach them
      to instances.
paths:
  /network/firewalls/{firewall_id}/rules:
    post:
      tags:
        - Firewall Rule
      summary: Create Firewall Rule
      description: >-
        Add a new rule to a firewall group.


        Special subnet values: `Cloudflare`, `Onidel`, `HetrixTools`,
        `CloudFront`, `UptimeRobot`.

        To reference an IP list, use `list:{ip_list_id}` as the subnet value.
      operationId: createFirewallRule
      parameters:
        - name: firewall_id
          in: path
          description: Firewall Group UUID
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewFirewallRule'
      responses:
        '201':
          description: Firewall rule created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FirewallRuleResponse'
        '400':
          description: Bad request - invalid parameters or duplicate rule
        '401':
          description: Unauthorized
        '404':
          description: Firewall group not found
      security:
        - api_key: []
components:
  schemas:
    NewFirewallRule:
      type: object
      properties:
        team_id:
          type: string
          format: uuid
        protocol:
          type: string
          enum:
            - tcp
            - udp
            - icmp
          example: tcp
        port:
          type: string
          example: '443'
          description: >-
            Port number or range (e.g. '80', '8000:9000'). Not required for
            ICMP.
        subnet:
          type: string
          example: 0.0.0.0
          description: >-
            IP/CIDR, special value (Cloudflare, Onidel, HetrixTools, CloudFront,
            UptimeRobot), or IP list (list:{uuid})
        subnet_size:
          type: string
          example: '0'
          description: CIDR prefix length
        desc:
          type: string
          example: Allow HTTPS traffic
      required:
        - protocol
        - subnet
        - subnet_size
    FirewallRuleResponse:
      type: object
      properties:
        firewall_rule:
          $ref: '#/components/schemas/FirewallRule'
    FirewallRule:
      type: object
      properties:
        id:
          type: string
          format: uuid
        group:
          type: string
          format: uuid
          description: Firewall group UUID
        ip_type:
          type: string
          enum:
            - v4
            - v6
        action:
          type: string
          example: allow
        protocol:
          type: string
          enum:
            - tcp
            - udp
            - icmp
        port:
          type: string
          example: '443'
          description: Port number or range (e.g. '80', '8000:9000')
        subnet:
          type: string
          example: 0.0.0.0
          description: >-
            IP address, CIDR, special value (Cloudflare, Onidel, etc.), or IP
            list reference (list:{uuid})
        subnet_size:
          type: string
          example: '0'
          description: CIDR prefix length
        desc:
          type: string
          example: Allow HTTPS
  securitySchemes:
    api_key:
      type: http
      scheme: bearer

````