---
title: "Create a firewall entry"
url: https://docs.corefinity.com/api/reference/firewall/create-firewall-entry
type: endpoint
last_updated: 2026-11-13
feature: firewall
related:
  - https://docs.corefinity.com/guides/sites/access-and-security/firewall.md
  - https://docs.corefinity.com/mcp/tools/corestack_firewall_entry_add.md
---
# Create a firewall entry

Adds an address or a range at one level: a company, a website, one environment, or yourself. A range may be as
wide as /24 (IPv6 /48); ask for a wider one with a range request. The address works once the change has been
applied.

```http
POST /api/firewall/entries
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 120 a minute; 30 a minute for each person; 120 a minute for each company
- Long-running: answers with an operation to poll
- Try it in the console: off. It has not been cleared for the console. Copy the request and run it yourself when you are sure.

## Body

- `address` (string, required): An IPv4 or IPv6 address, or a range in CIDR form. A range may be as wide as /24 (IPv6 /48). Private, reserved and provider ranges are refused.
- `comment` (string or null): A note to recognise the address by.
- `expires_in_days` (integer or null): After how many days the address stops being allowed. Null, or left out, for no expiry. One of `1`, `30`, `90`, `365`, `null`.
- `owner_id` (integer, required): The id of the environment, website or company. For `user`, your own user id.
- `owner_type` (string, required): The level an address is held at. `user` is yourself. One of `environment`, `website`, `company`, `user`.
- `scope` (string): Left out, the address gets `both`. What the address may reach. `ssh` is SSH only, `web` the website only, `both` both. One of `both`, `ssh`, `web`.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/firewall/entries \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "198.51.100.0/24",
    "comment": "Head office",
    "owner_id": 1204,
    "owner_type": "company",
    "scope": "ssh"
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/firewall/entries', [
        'address' => '198.51.100.0/24',
        'comment' => 'Head office',
        'owner_id' => 1204,
        'owner_type' => 'company',
        'scope' => 'ssh',
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/firewall/entries', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    address: '198.51.100.0/24',
    comment: 'Head office',
    owner_id: 1204,
    owner_type: 'company',
    scope: 'ssh',
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.post(
    "https://manage.corefinity.com/api/firewall/entries",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "address": "198.51.100.0/24",
        "comment": "Head office",
        "owner_id": 1204,
        "owner_type": "company",
        "scope": "ssh",
    },
)

data = res.json() if res.content else None
```

## Responses

### 201 The address was added. Follow `change_id` with `GET /firewall/changes/{change}` to see it applied.

```json
{
  "change_id": 5310,
  "covered_by": null,
  "entry": {
    "added_by": {
      "name": "Eleanor Finch",
      "on_behalf_of": null,
      "support": false
    },
    "carried_from": null,
    "changed_at": "2026-11-06T09:16:40Z",
    "cidr": "203.0.113.42/32",
    "comment": "Contractor",
    "created_at": "2026-11-06T09:16:40Z",
    "decision_reason": null,
    "editable": true,
    "expires_at": "2027-01-04T09:16:40Z",
    "family": 4,
    "id": 9002,
    "layer": "environment",
    "owner": {
      "id": 1311,
      "name": "Production",
      "type": "environment"
    },
    "path": null,
    "request_reason": null,
    "scope": {
      "ssh": true,
      "web": true
    },
    "source": "manual",
    "status": "active",
    "web_paused": false
  }
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the `write` scope (`scope_required`), your company requires two-factor authentication and you have not set it up (`two_factor_required`), or you can see the entry or preset but may not change it, as with one your agency holds (`firewall_not_editable`).

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist or is something you cannot reach (`not_found`; both answer the same body), or the firewall is not on for it (`feature_off`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 422 The request was refused. `reason` says why: - `invalid_arguments`: a field is missing, wrong or not part of the request; `field` names it. - `firewall_address_invalid`: `address` is not an IPv4 or IPv6 address or a range in CIDR form. - `firewall_width_refused`: a range of /8 or wider. These are never accepted. - `firewall_approval_required`: a range wider than /24 (IPv6 /48). Send it as a range request. - `firewall_address_refused`: a private, reserved or provider range; the message names which. The documentation ranges the examples on this page use (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, 2001:db8::/32) are refused too: send an address of your own. - `firewall_duplicate`: the address is already on this list. - `firewall_scope_invalid`: the scope cannot apply to this address here, such as SSH only for an IPv6 address, or website access on CoreStack Enterprise. - `firewall_cap_exceeded`: the list, or an environment it reaches, holds its limit of addresses.

```json
{
  "code": "firewall_address_invalid",
  "field": "address",
  "message": "Enter an IPv4 or IPv6 address, or a range in CIDR form (for example 203.0.113.0/24).",
  "reason": "firewall_address_invalid"
}
```

### 429 Too many requests: the endpoint's request limit (`rate_limited`, with `Retry-After`), or the firewall's own budget of 30 changes a minute for you and 120 for your company, which the Control Panel and AI assistants spend too (`firewall_throttled`). The budget's answer names no wait: try again after a minute.

```json
{
  "code": "firewall_throttled",
  "field": null,
  "message": "Too many firewall changes. Wait a minute and try again.",
  "reason": "firewall_throttled"
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `firewall_not_editable` | You can see this entry but you cannot change it. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 | `feature_off` | This feature is not on for your organisation yet. |
| 404 | `not_found` | Not found. |
| 422 | `firewall_address_invalid` | Enter an IPv4 or IPv6 address, or a range in CIDR form (for example 203.0.113.0/24). |
| 422 | `firewall_address_refused` | That address is in a private range and cannot be allowed. |
| 422 | `firewall_approval_required` | Ranges wider than /24 (IPv6 /48) need approval from Corefinity. Send it as a range request. |
| 422 | `firewall_cap_exceeded` | This list already holds its limit of 200 addresses. |
| 422 | `firewall_duplicate` | That address is already on this list. |
| 422 | `firewall_width_refused` | That range is far too wide to allow. Ranges of /8 or wider are never accepted. |
| 422 | `invalid_arguments` | The arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again. |
| 429 | `firewall_throttled` | Too many firewall changes. Wait a minute and try again. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Firewall](https://docs.corefinity.com/guides/sites/access-and-security/firewall.md)
- MCP tool: [`corestack_firewall_entry_add`](https://docs.corefinity.com/mcp/tools/corestack_firewall_entry_add.md)
