> For the complete documentation index, see [llms.txt](https://docs.layerstack.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerstack.com/api-docs/layerstack-api/firewalls.md).

# Firewalls

## Firewalls

`Firewalls` is the entity that handles firewall operations to a cloud server. Currently only assigning and unassigning a firewall are supported by our API. Creation of firewall and editing firewall rules should be done in our LayerPanel.

### Endpoints Summary

<table><thead><tr><th width="343">ENDPOINT (CLICK TO READ FULL SPECIFICATION)</th><th width="93.33333333333331">METHOD</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><a href="https://developers.layerstack.com/Firewalls.md#assign-firewall">/firewalls/assign/object/$vm_object_id</a></td><td>POST</td><td>assign firewall(s) to an object (cloud server).</td></tr><tr><td><a href="https://developers.layerstack.com/Firewalls.md#unassign-firewall">/firewalls/unassign/object/$vm_object_id</a></td><td>POST</td><td>unassign firewall(s) from an object (cloud server).</td></tr><tr><td><a href="https://developers.layerstack.com/Firewalls.md#get-firewalls">/firewalls/object/$vm_object_id</a></td><td>GET</td><td>get firewall list from an object (cloud server).</td></tr></tbody></table>

### Assign Firewalls to a Cloud Server <a href="#assign-firewall" id="assign-firewall"></a>

Request: `POST /firewalls/assign/object/$vm_object_id` where `$vm_object_id` is the object id of the cloud server.

<table><thead><tr><th width="161.33333333333331">NAME</th><th width="98">TYPE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>firewalls</code></td><td><code>array</code></td><td>ids of firewall to be assigned. ID of firewall can be obtained from Firewall Details page in LayerPanel.</td></tr></tbody></table>

Sample Payload:

```
{"firewalls":[{"id":143}, {"id":144}]}
```

### Unassign Firewalls from a Cloud Server <a href="#unassign-firewall" id="unassign-firewall"></a>

Request: `POST /firewalls/unassign/object/$vm_object_id` where `$vm_object_id` is the object id of the cloud server.

<table><thead><tr><th width="144.33333333333331">NAME</th><th width="131">TYPE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>firewalls</code></td><td><code>array</code></td><td>ids of firewall to be assigned. ID of firewall can be obtained from Firewall Details page in LayerPanel.</td></tr></tbody></table>

Sample Payload:

```
{"firewalls":[{"id":153}, {"id":154}]}
```

### Get Firewalls List of a Cloud Server <a href="#get-firewalls" id="get-firewalls"></a>

Request: `GET /firewalls/object/$vm_object_id` where `$vm_object_id` is the object id of the cloud server.
