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

# Create Firewall Rule

> Create a new firewall rule for the server.



## OpenAPI

````yaml post /servers/{server}/firewall
openapi: 3.1.0
info:
  title: APIFiddle Sample Definition
  version: 0.0.0
  description: Example workspace
servers:
  - url: https://rdp.sh/api/v1
    description: Default production endpoint.
security: []
paths:
  /servers/{server}/firewall:
    post:
      summary: Create firewall rule
      description: Create a new firewall rule for the server.
      operationId: createFirewallRule
      parameters:
        - $ref: '#/components/parameters/server'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - action
                - type
              properties:
                action:
                  type: string
                  enum:
                    - ACCEPT
                    - DROP
                    - REJECT
                  description: Rule action
                type:
                  type: string
                  enum:
                    - in
                    - out
                  description: Traffic direction
                proto:
                  type: string
                  description: Protocol (tcp, udp, icmp, etc.)
                dport:
                  type: string
                  description: Destination port(s)
                sport:
                  type: string
                  description: Source port(s)
                source:
                  type: string
                  description: Source IP/CIDR
                dest:
                  type: string
                  description: Destination IP/CIDR
                comment:
                  type: string
                  maxLength: 255
                  description: Rule comment
                enable:
                  type: boolean
                  description: Whether rule is enabled
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                title: CreateFirewallRuleOk
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
          description: Firewall rule created successfully.
        '403':
          description: Unauthorized access.
        '422':
          description: Validation error.
        '500':
          description: Failed to create rule.
      security:
        - Authorization: []
components:
  parameters:
    server:
      in: path
      name: server
      schema:
        type: string
      required: true
  securitySchemes:
    Authorization:
      in: header
      name: Authorization
      type: apiKey

````