> ## 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.

# Toggle Firewall

> Enable or disable the firewall for a server. The response includes the
firewall state after the change. Only whitelisted servers may disable
the firewall; for everyone else, `enable: false` returns 403.




## OpenAPI

````yaml post /servers/{server}/firewall/toggle
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/toggle:
    post:
      summary: Toggle firewall
      description: |
        Enable or disable the firewall for a server. The response includes the
        firewall state after the change. Only whitelisted servers may disable
        the firewall; for everyone else, `enable: false` returns 403.
      operationId: toggleFirewall
      parameters:
        - $ref: '#/components/parameters/server'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - enable
              properties:
                enable:
                  type: boolean
                  description: |
                    Set to `true` to enable the firewall, `false` to disable it.
                    Disabling is only permitted for whitelisted servers.
                  examples:
                    - true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                title: ToggleFirewallOk
                properties:
                  status:
                    type: boolean
                    examples:
                      - true
                  message:
                    type: string
                    examples:
                      - Firewall enabled successfully
                  enabled:
                    type: boolean
                    description: Current firewall state after the toggle.
                    examples:
                      - true
          description: Firewall state updated successfully.
        '403':
          content:
            application/json:
              schema:
                type: object
                title: ToggleFirewallForbidden
                properties:
                  status:
                    type: boolean
                    examples:
                      - false
                  error:
                    type: string
                    examples:
                      - >-
                        Firewall cannot be disabled. Only whitelisted servers
                        can disable the firewall.
          description: >-
            Unauthorized, or the server is not whitelisted to disable the
            firewall.
        '422':
          description: Validation error.
        '500':
          description: Failed to toggle firewall.
      security:
        - Authorization: []
components:
  parameters:
    server:
      in: path
      name: server
      schema:
        type: string
      required: true
  securitySchemes:
    Authorization:
      in: header
      name: Authorization
      type: apiKey

````