# Add a DDoS filtering rule to an IP address

`POST https://console.advinservers.com/api/v1/client/servers/{server}/ddos-protection/ip/{ip}/profiles`

### Overview

Creates a filtering rule that applies immediately. Send `presetId` and `protocol` (`TCP`, `UDP`, `ICMP`, `IPIP`, `GRE`, `ESP` or `AH`). TCP and UDP require `minDstPort`; add `maxDstPort` for a range. `notes` is optional. Returns 422 if the protection service rejects the rule.

### Permissions

Requires the `network.update` (Change networking) permission for the selected team. Resources outside that team return 404.

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Path parameters

- `server` (string, required): The server uuid short
- `ip` (string, required): The ip ID.

## Body

Sent as `application/json`.

- `protocol` (string, required): The value of `protocol`. One of: `TCP`, `UDP`, `ICMP`, `IPIP`, `GRE`, `ESP`, `AH`.
- `minDstPort` (integer | null): The value of `min_dst_port`. 1 to 65535
- `maxDstPort` (integer | null): The value of `max_dst_port`. 1 to 65535
- `notes` (string | null): Optional notes about the request. At most 255 characters
- `presetId` (string, required): The preset id ID.

## Response 201

The record, as a JSON object. There is no envelope.

- `id` (string, required): The id ID.
- `protocol` (string, required): The value of `protocol`.
- `minDstPort` (integer | null, required): The value of `min_dst_port`.
- `maxDstPort` (integer | null, required): The value of `max_dst_port`.
- `preset` (object | null, required): The value of `preset`.
  - `id` (string | null, required): The id ID.
  - `name` (string, required): The name shown to customers.
  - `protocol` (string, required): The value of `protocol`.
- `notes` (string | null, required): Optional notes about the request.
- `createdAt` (string | null, required): The provider's own timestamps, in the provider's own format. Kept as strings and parsed where they are rendered: the provider does not promise anything this side could safely read as a date.
- `updatedAt` (string | null, required): The date and time for updated at, in UTC.

```json
{
  "id": "a45afea6-a83e-4685-b7d5-029d0a91e81e",
  "protocol": "TCP",
  "minDstPort": 443,
  "maxDstPort": 443,
  "preset": {
    "id": "19cfb2ea-daa8-4693-ad63-9d147b00b8f7",
    "name": "HTTPS",
    "protocol": "TCP"
  },
  "notes": "Black Mesa announcement system",
  "createdAt": "2026-03-04T10:22:51Z",
  "updatedAt": "2026-03-04T10:22:51Z"
}
```

## Errors

- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `404`: The resource was not found in the selected team. Resources in another account or team also return 404.
- `422`: A field is missing or invalid, or the resource cannot accept this change in its current state. Check `message` for details. Field validation also includes an `errors` object keyed by field name.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.

## Example request

```bash
curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/servers/{server}/ddos-protection/ip/{ip}/profiles' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "protocol": "TCP",
  "minDstPort": 22,
  "maxDstPort": 22,
  "notes": "Sector C maintenance shell",
  "presetId": "ce736ad0-0ad7-4b43-95b8-1156cccdf2be"
}'
```
