---
title: "Attach a firewall preset"
url: https://docs.corefinity.com/api/reference/firewall/attach-firewall-preset
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_preset_attach.md
---
# Attach a firewall preset

Attaches a preset at a company, a website, one environment or yourself, so every range of the preset may
connect over SSH. The ranges follow the preset as Corefinity updates it.

```http
POST /api/firewall/preset-subscriptions
```

- 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

- `owner_id` (integer, required)
- `owner_type` (string, required): The level an address is held at. `user` is yourself. One of `environment`, `website`, `company`, `user`.
- `preset_id` (integer, required): The id of a preset, as `GET /firewall/presets` answers it.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/firewall/preset-subscriptions \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "owner_id": 1204,
    "owner_type": "company",
    "preset_id": 12
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/firewall/preset-subscriptions', [
        'owner_id' => 1204,
        'owner_type' => 'company',
        'preset_id' => 12,
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/firewall/preset-subscriptions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    owner_id: 1204,
    owner_type: 'company',
    preset_id: 12,
  }),
});

// 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/preset-subscriptions",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "owner_id": 1204,
        "owner_type": "company",
        "preset_id": 12,
    },
)

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

## Responses

### 201 The preset was attached. Follow `change_id` with `GET /firewall/changes/{change}`.

```json
{
  "change_id": 5312,
  "subscription": {
    "added_by": {
      "name": "Eleanor Finch",
      "on_behalf_of": null,
      "support": false
    },
    "created_at": "2026-11-06T09:16:40Z",
    "editable": true,
    "id": 311,
    "layer": "company",
    "owner": {
      "id": 1204,
      "name": "Harbour & Finch",
      "type": "company"
    },
    "preset": {
      "description": "The addresses Bitbucket Pipelines builds connect from.",
      "id": 12,
      "name": "Bitbucket Pipelines",
      "ranges_count": 2,
      "slug": "bitbucket-pipelines"
    }
  }
}
```

### 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) or `firewall_preset_present` (the preset is already attached at this owner).

```json
{
  "code": "firewall_preset_present",
  "field": "preset_id",
  "message": "That preset is already attached here.",
  "reason": "firewall_preset_present"
}
```

### 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_preset_present` | That preset is already attached here. |
| 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_preset_attach`](https://docs.corefinity.com/mcp/tools/corestack_firewall_preset_attach.md)
