# Firewall

Manage the firewall rules, access rules and captcha IP lists of a domain, and choose which protections a rule skips.

The firewall decides what happens to the requests of a domain: allow them, block them, challenge them, or let them skip another protection. Everything here works on one domain at a time, and the paths start with `/v2/cdn/firewall/{domain_public_id}/`, where the id is the public id of the domain, taken from [the domains list](https://docs.diamwall.com/products/domains/#list-your-domains).

- [Firewall rules](#firewall-rules): Ordered rules with conditions: allow, block, challenge or skip.
- [Access rules](#access-rules): One rule for one IP, country, continent, ASN or user agent.
- [Captcha IP lists](#captcha-ip-lists): The captcha allow list and the captcha bypass list.
- [Skip options and settings](#skip-options): What a skip rule can skip, and the state of the firewall group.

The examples on this page use these shell variables:

```bash
export DIAMWALL_API_KEY="your key"
export FIREWALL="https://api.diamwall.com/v2/cdn/firewall/your-domain-public-id"
```

## How the collections work

The firewall has four collections: `rules/`, `access-rules/`, `allow-captcha-ips/` and `bypass-captcha-ips/`. They are independent, and they all behave the same way.

**Lists come in pages.** The query takes `limit` (1 to 100, 50 without it) and `cursor`, and nothing else. Send `data.page.next_cursor` back as `cursor` until it is `null`. `data.page.total` counts the whole collection. If the collection changes between two pages, the next page answers `409 CURSOR_STALE`: start again from the first page.

**Writes need the latest revision.** Every list and every single item answers an `ETag` header. It is the revision of the whole collection, not of one item, and an empty collection has one too. Send it back in `If-Match` on every create, edit, delete and reorder:

```bash
ETAG=$(curl -s -o /dev/null -D - "$FIREWALL/rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  | tr -d '\r' | awk 'tolower($1) == "etag:" { print $2 }')
```

- Without `If-Match` the write answers `428`.
- If the collection changed since your read, it answers `412 REVISION_MISMATCH`. Read again, check your change still makes sense, then send it with the new `ETag`.
- Every successful write answers a new `ETag` header to use on your next write.
- An `ETag` of one collection does not work on another.

**Every answer has the same envelope.** Next to `data` you get `revision`, `consistency` (`verified`, `degraded` or `unknown`) and `publication`. A write also answers `operation`, with its `type` and the `id` of the item it touched.

> **An error is never an empty list**
> An empty `data.items` means the domain has nothing in that collection. When a collection cannot be read, the answer is an error such as `INVALID_STATE`. Show it as unavailable, never as empty.

## Firewall rules

A firewall rule has a name, an on and off switch, a place in the order, optional conditions and an action.

| Field | What it holds |
| --- | --- |
| `name` | One line, 1 to 128 bytes. Two rules cannot share a name. |
| `description` | Optional. One line, at most 1024 bytes. An empty string clears it. |
| `enabled` | `true` applies the rule, `false` keeps it without applying it. |
| `priority` | A whole number from 1 to 1000000. The lowest is evaluated first. |
| `type` | `all` for every request of the domain, `filter` for the requests that `expressions` select. |
| `expressions` | The conditions of a `filter` rule, 1 to 32 of them. |
| `action` | `allow`, `block`, `challenge` or `skip`. |
| `skip` | What a `skip` rule skips. See [Skip rules](#skip-rules). |

Each condition is an object with exactly four keys:

| Key | Allowed values |
| --- | --- |
| `type` | `main` for the first condition, then `main`, `and` or `or` |
| `field` | `ip`, `country`, `continent`, `asn`, `ua`, `cookie`, `hostname`, `referer`, `reqmethod`, `ssl`, `uri`, `fulluri`, `querystring`, `httpversion` |
| `operator` | `equals`, `not_equals`, `contains`, `not_contains` |
| `value` | One line, 1 to 2048 bytes |

### List the rules

[`GET /v2/cdn/firewall/{domain_public_id}/rules/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/GET/v2/cdn/firewall/{domain_public_id}/rules/)

```bash
curl "$FIREWALL/rules/?limit=50" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY"
```

```json
{
  "revision": "sha256:4503ba3c3012...",
  "consistency": "verified",
  "publication": { "status": "verified", "rollout": "unknown" },
  "data": {
    "items": [
      {
        "id": "r_00000000000000000000000000000006",
        "name": "Challenge the public pages",
        "description": "Illustrative rule",
        "enabled": true,
        "priority": 10,
        "type": "filter",
        "expressions": [
          { "type": "main", "field": "uri", "operator": "contains", "value": "/public" }
        ],
        "action": "challenge",
        "managed": true,
        "state": "resolved"
      }
    ],
    "page": { "limit": 50, "next_cursor": null, "total": 1 }
  }
}
```

- To read one rule, call `GET .../rules/{rule_id}/` with an `id` from the list.
- A key the CDN could not answer is left out, never made up. A rule with no `enabled` is not a rule that is off, and a `priority` outside 1 to 1000000 is left out.
- A value outside the lists above comes back as `other`. Show it as it is, and never send it.

> **Rules whose id starts with l_**
> Most rules have an id made of `r_` and 32 hexadecimal digits. A rule kept from an older format has an id that starts with `l_`.
>
> - You can edit or delete an `l_` rule, but never reorder it. It answers `reorderable: false`.
> - Its conditions may use the operators `regex` and `not_regex_ci`. You can keep them in an edit, but new conditions use the four operators above.
> - When the rule could not be read in full, it answers `managed: false` and `state: "unknown"`, with a `reason`, and `action` and `expressions` may be `null` or missing. An edit of such a rule answers `409 INVALID_STATE`.

### Create a rule

[`POST /v2/cdn/firewall/{domain_public_id}/rules/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/POST/v2/cdn/firewall/{domain_public_id}/rules/)

`name`, `enabled`, `type` and `action` are required. `expressions` is required when `type` is `filter`, and `skip` when `action` is `skip`. Without `priority`, the CDN gives the rule one.

**With conditions**

```bash
curl -X POST "$FIREWALL/rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ETAG" \
  -d '{
    "name": "Block an old client",
    "enabled": true,
    "priority": 20,
    "type": "filter",
    "expressions": [
      { "type": "main", "field": "country", "operator": "equals", "value": "PT" },
      { "type": "and", "field": "ua", "operator": "contains", "value": "ExampleBrowser/" }
    ],
    "action": "block"
  }'
```

**Every request**

```bash
curl -X POST "$FIREWALL/rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ETAG" \
  -d '{
    "name": "Challenge every request",
    "enabled": false,
    "type": "all",
    "action": "challenge"
  }'
```

The answer is `201` with the new rule under `data`, its id in `operation.id`, and a new `ETag` header.

- Nothing is trimmed, converted or filled in. The rule is stored as you send it.
- A wrong condition is named by its position, for example `"fields": ["expressions", "expressions.2.operator"]`. Positions start at 0.
- A name another rule already has answers `409 RULE_NAME_CONFLICT` or `409 RESOURCE_CONFLICT`. Choose another name.
- A domain holds at most 100 of these rules, whatever its plan. One more answers `400 INVALID_REQUEST` with a `request_id`.

### Change a rule

[`PATCH /v2/cdn/firewall/{domain_public_id}/rules/{rule_id}/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/PATCH/v2/cdn/firewall/{domain_public_id}/rules/{rule_id}/)

Send only the fields that change, never the whole rule you read. A field you leave out keeps its value. `expressions`, when sent, is the whole list of conditions.

```bash
curl -X PATCH "$FIREWALL/rules/r_00000000000000000000000000000006/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ETAG" \
  -d '{ "enabled": false }'
```

An empty body (`{}`) answers `400 NO_CHANGES`. The read-only keys `id`, `managed`, `state`, `reason`, `reorderable` and `source_version` are refused.

### Reorder the rules

[`PUT /v2/cdn/firewall/{domain_public_id}/rules/order/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/PUT/v2/cdn/firewall/{domain_public_id}/rules/order/)

The body is exactly `{ "ids": [...] }`: every `r_` id of the collection, once each, in the order you want. It is the whole order, never only the rules that moved. Read every page of the list first so that you have all the ids.

```bash
curl -X PUT "$FIREWALL/rules/order/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ETAG" \
  -d '{
    "ids": [
      "r_00000000000000000000000000000007",
      "r_00000000000000000000000000000006"
    ]
  }'
```

- Leave every `l_` id out. Those rules are not moved, and they are still in the collection afterwards.
- A list that leaves a rule out, or names one the collection does not have, answers `400 INVALID_REQUEST` with a `request_id`. Read the collection again and send the whole order.
- The answer holds the whole collection in its new order under `data.items`, with no paging. `operation` has no `id`.

### Delete a rule

[`DELETE /v2/cdn/firewall/{domain_public_id}/rules/{rule_id}/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/DELETE/v2/cdn/firewall/{domain_public_id}/rules/{rule_id}/)

```bash
curl -X DELETE "$FIREWALL/rules/r_00000000000000000000000000000006/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "If-Match: $ETAG"
```

The answer has no rule in it, only the envelope and `operation`, whose `id` is the id that was deleted.

## Skip rules

A rule with `action: "skip"` lets the requests it matches pass one or more protection layers without being checked by them. The `skip` object says which.

| Layer | `true` skips the whole layer | Or select part of it |
| --- | --- | --- |
| `waf` | Yes | `categories`, `rule_ids` |
| `packet_inspection` | Yes | `rule_ids` |
| `threat_intelligence` | Yes | `tiers`, `sources` |
| `adaptive_protection` | Yes | No |

- A layer you leave out is checked as usual.
- `true` skips the whole layer, including rules added to it later.
- When several skip rules match a request, the last one that matches decides what is skipped.
- Firewall rules with `allow`, `block` or `challenge` still apply to the request.

### Skip options

[`GET /v2/cdn/firewall/{domain_public_id}/references/firewall-skip-options/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/GET/v2/cdn/firewall/{domain_public_id}/references/firewall-skip-options/)

Before you write a selection, read what this domain can skip. The ids you send in `rule_ids`, `categories`, `tiers` and `sources` come from this catalog.

```bash
curl "$FIREWALL/references/firewall-skip-options/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY"
```

```json
{
  "data": {
    "state": "resolved",
    "items": [
      {
        "id": "waf",
        "available": true,
        "whole_layer": true,
        "selectors_available": true,
        "rule_ids": ["example-rule"],
        "categories": ["example-category"],
        "rules": [
          { "id": "example-rule", "category": "example-category", "name": "Example WAF rule", "phase": "request" }
        ]
      }
    ],
    "page": { "limit": 50, "next_cursor": null, "total": 1 }
  }
}
```

- Each item is one layer. Follow `data.page.next_cursor` until it is `null`.
- You can skip a layer in full only when `available` and `whole_layer` are both `true`.
- `selectors_available: false` means you cannot select part of the layer. When the key is missing, it is not known.
- The size limits of a selection are in `data.max_tokens` and `data.max_encoded_bytes`.
- A `data.state` other than `resolved` has no `items`. The catalog is unavailable, not empty.

### Create a skip rule

[`POST /v2/cdn/firewall/{domain_public_id}/rules/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/POST/v2/cdn/firewall/{domain_public_id}/rules/)

```bash
curl -X POST "$FIREWALL/rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ETAG" \
  -d '{
    "name": "Skip selected WAF rules for the status endpoint",
    "enabled": false,
    "type": "filter",
    "expressions": [
      { "type": "main", "field": "uri", "operator": "equals", "value": "/status" }
    ],
    "action": "skip",
    "skip": { "waf": { "rule_ids": ["example-rule"] } }
  }'
```

When you edit a skip rule:

- A `skip` you send replaces the whole selection.
- To turn another rule into a skip rule, send `action` and `skip` together.
- Changing the action to `allow`, `block` or `challenge` clears the selection.
- An edit of other fields, such as `description`, keeps the selection.

## Access rules

An access rule is a short rule for one thing: an address, a country, a continent, an ASN or a user agent. Rules for user agents live in the same collection, with `type: "user_agent"`.

| Field | What it holds |
| --- | --- |
| `name` | One line, 1 to 128 bytes. |
| `description` | Optional. One line, at most 1024 bytes. An empty string clears it. |
| `type` | `ip`, `country`, `continent`, `asn` or `user_agent`. Chosen at creation, never edited. |
| `value` | What the rule matches, of its type. One line, not empty. |
| `action` | `allow`, `block` or `challenge`. |
| `operator` | `equals` or `contains`. Optional, and only for a `user_agent` rule. |

### List the access rules

[`GET /v2/cdn/firewall/{domain_public_id}/access-rules/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/GET/v2/cdn/firewall/{domain_public_id}/access-rules/)

```bash
curl "$FIREWALL/access-rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY"
```

```json
{
  "data": {
    "items": [
      {
        "id": "e0oPsVJdN-65a_TBGlW1iT8r",
        "type": "ip",
        "value": "192.0.2.10",
        "action": "challenge",
        "name": "Office IP",
        "description": "Illustrative office rule"
      }
    ],
    "page": { "limit": 50, "next_cursor": null, "total": 1 }
  }
}
```

To read one rule, call `GET .../access-rules/{rule_id}/`. A rule that was never given a name has one that begins with `Imported`, and no `description`. Edit it with a `name` to rename it. Its `id` stays the same.

### Create an access rule

[`POST /v2/cdn/firewall/{domain_public_id}/access-rules/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/POST/v2/cdn/firewall/{domain_public_id}/access-rules/)

Read the access rules first to get their `ETag`, then send `name`, `type`, `action` and `value`:

**Address**

```bash
curl -X POST "$FIREWALL/access-rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ACCESS_ETAG" \
  -d '{
    "name": "Office IP",
    "description": "Illustrative office rule",
    "type": "ip",
    "action": "challenge",
    "value": "192.0.2.10"
  }'
```

**Country**

```bash
curl -X POST "$FIREWALL/access-rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ACCESS_ETAG" \
  -d '{ "name": "Portugal", "type": "country", "action": "block", "value": "PT" }'
```

**User agent**

```bash
curl -X POST "$FIREWALL/access-rules/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ACCESS_ETAG" \
  -d '{
    "name": "Test browser",
    "type": "user_agent",
    "action": "allow",
    "value": "ExampleBrowser/",
    "operator": "contains"
  }'
```

- The CDN checks that `value` is valid for its `type`, and may store it in a normalised form. So the rule can come back with a `value` that is not letter for letter what you sent. A value it does not take answers `400 INVALID_REQUEST` with a `request_id`.
- `operator` next to any type other than `user_agent` answers `400 INVALID_REQUEST` with `operator` in `fields`.
- A second rule with the same `type` and `value` answers `409 RESOURCE_CONFLICT`. Edit the rule that is there, or choose another value.
- A domain holds at most 5000 access rules, 1000 of them for user agents, whatever its plan.

### Change an access rule

[`PATCH /v2/cdn/firewall/{domain_public_id}/access-rules/{rule_id}/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/PATCH/v2/cdn/firewall/{domain_public_id}/access-rules/{rule_id}/)

Send at least one of `name`, `description`, `action`, `operator` and `value`. A field you leave out keeps its value.

```bash
curl -X PATCH "$FIREWALL/access-rules/e0oPsVJdN-65a_TBGlW1iT8r/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $ACCESS_ETAG" \
  -d '{ "action": "block" }'
```

`type` cannot be edited. To change the type of a rule, delete it and create another.

> **A new value means a new id**
> The `id` of an access rule comes from its `type` and its `value`. Changing the name, description or action keeps the id. Changing the `value` gives the rule another id, and the old one may answer `404`. After such an edit, take the id from `operation.id` and read the collection again.

### Delete an access rule

[`DELETE /v2/cdn/firewall/{domain_public_id}/access-rules/{rule_id}/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/DELETE/v2/cdn/firewall/{domain_public_id}/access-rules/{rule_id}/)

```bash
curl -X DELETE "$FIREWALL/access-rules/e0oPsVJdN-65a_TBGlW1iT8r/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "If-Match: $ACCESS_ETAG"
```

## Captcha IP lists

[Firewall in the API reference](https://docs.diamwall.com/api/#tag/firewall)

A domain has two lists of IPv4 addresses for its captcha. They are independent: each has its own items, its own ids and its own `ETag`.

| List | Path |
| --- | --- |
| Captcha allow IPs | `.../allow-captcha-ips/` |
| Captcha bypass IPs | `.../bypass-captcha-ips/` |

Both lists take the same four calls. The examples use the allow list. For the bypass list, change the path.

| You want to | Call |
| --- | --- |
| List the addresses | `GET .../allow-captcha-ips/` |
| Read one address | `GET .../allow-captcha-ips/{ip_id}/` |
| Add an address | `POST .../allow-captcha-ips/` with `If-Match` |
| Remove an address | `DELETE .../allow-captcha-ips/{ip_id}/` with `If-Match` |

There is no edit. To change an address, remove it and add the new one.

### Add an address

[`POST /v2/cdn/firewall/{domain_public_id}/allow-captcha-ips/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/POST/v2/cdn/firewall/{domain_public_id}/allow-captcha-ips/)

The body is exactly one `ip`: a single IPv4 address. IPv6 addresses, CIDR blocks and ranges are refused.

```bash
curl -X POST "$FIREWALL/allow-captcha-ips/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: $CAPTCHA_ETAG" \
  -d '{ "ip": "192.0.2.11" }'
```

```json
{
  "data": { "id": "FROwCuKRvOxT9IM_l9VClH8_", "ip": "192.0.2.11" },
  "operation": { "type": "create", "id": "FROwCuKRvOxT9IM_l9VClH8_" }
}
```

An address already in the list answers `409 RESOURCE_CONFLICT`. A list holds at most 4096 addresses. One more answers `400 INVALID_REQUEST`.

### Remove an address

[`DELETE /v2/cdn/firewall/{domain_public_id}/allow-captcha-ips/{ip_id}/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/DELETE/v2/cdn/firewall/{domain_public_id}/allow-captcha-ips/{ip_id}/)

```bash
curl -X DELETE "$FIREWALL/allow-captcha-ips/FROwCuKRvOxT9IM_l9VClH8_/" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY" \
  -H "If-Match: $CAPTCHA_ETAG"
```

## Firewall settings

[`GET /v2/cdn/firewall/{domain_public_id}/settings/firewall/` in the API reference](https://docs.diamwall.com/api/#tag/firewall/GET/v2/cdn/firewall/{domain_public_id}/settings/firewall/)

`GET .../settings/firewall/` is read-only and answers no `data`. It tells you that the firewall of the domain could be read, and at which `revision`:

```json
{
  "revision": "sha256:f76bd62919a5...",
  "consistency": "verified",
  "publication": { "status": "verified", "rollout": "unknown" }
}
```

When the firewall could not be read, the answer has `state: "unknown"` and a `revision` of `null`. Show the firewall as unavailable. To read the rules and lists themselves, use the collections above. This answer has no `ETag`, and any other method on this path answers `403 PERMISSION_DENIED`.

## Limits and permissions

- **Credits.** Each domain has a budget of 3000 credits a minute, shared by everyone who calls the API for that domain. Reading the access rules costs 6 credits. The other reads and writes of rules cost 8.
- **Creating a rule costs 38.** A create of a firewall rule or of an access rule costs 8 credits, plus 30 for the four reads that count the plan limit. Those 30 stay spent when the create is then refused with `PLAN_LIMIT_EXCEEDED` or `REVISION_MISMATCH`.
- **Out of credits.** The call answers `429 TOO_MANY_REQUESTS`, with the wait in `details.retry_after_seconds`.
- **Plan limit.** Pro allows 25 rules, Business 100, Enterprise 200. The limit counts four things together: firewall rules, access rules, the exceptions of WAF rules, and the root exceptions of the DWAF. A create at the limit answers `400 PLAN_LIMIT_EXCEEDED`, with `details.limit`, `details.current`, `details.plan` and `details.feature`. Edits, deletes and reorders are never counted.
- **Fixed ceilings.** Apart from the plan, a domain holds at most 100 firewall rules, 5000 access rules (1000 of them for user agents) and 4096 addresses in a captcha list. A change of plan does not raise these.
- **Permissions.** Reads need `waf.view` on the domain. Creating needs `waf.create`, and deleting needs `waf.delete`. Editing and reordering need `waf.edit`, which `waf.create` and `waf.delete` both include.

## Errors you are likely to see

| Status | Code | What happened |
| --- | --- | --- |
| `400` | `INVALID_REQUEST` | A field is wrong. The answer names it in `fields`. With a `request_id`, the CDN refused a value, an incomplete order or a full collection. |
| `400` | `NO_CHANGES` | An edit was sent with nothing to change. |
| `400` | `INVALID_PRECONDITION` | `If-Match` is not the `ETag` exactly as it came, with its quotes. |
| `400` | `PLAN_LIMIT_EXCEEDED` | The domain is at the rule limit of its plan. |
| `404` | `RESOURCE_ITEM_NOT_FOUND` | Nothing in the collection has that `id`. It may have been deleted, or be an access rule whose `value` changed. |
| `404` | `RULE_NOT_FOUND` | The rule was gone when the write reached it. Read the collection again. |
| `409` | `CURSOR_STALE` | The collection changed while you were paging. Start from the first page. |
| `409` | `RULE_NAME_CONFLICT` | Another firewall rule has that name. |
| `409` | `RESOURCE_CONFLICT` | The access rule or the address is already there, or another firewall rule has that name. |
| `409` | `INVALID_STATE` | The collection cannot be read or written in its current state, or the `l_` rule cannot be edited. Sending the request again does not help. |
| `409` | `DOMAIN_BUSY` | Another change to the domain is in progress. Wait, then retry with the same `If-Match`. |
| `412` | `REVISION_MISMATCH` | The collection changed since your read. Read again and retry. |
| `428` | `PRECONDITION_REQUIRED` | The `If-Match` header is missing. |
| `429` | `TOO_MANY_REQUESTS` | The domain is out of credits for now. |
| `502` | `FILE_SERVER_OUTCOME_UNKNOWN` | The answer of a write was lost, so the write may have been made. Read the collection before you send it again. |
| `503` | `ROLLBACK_FAILED` | A write failed and the state of the collection is not known. Read it again before any other attempt, and quote `request_id` to support. |
| `503` | `WRITE_VERIFICATION_FAILED` | A write to a captcha list could not be confirmed. Read the list before you repeat it. |

The errors that come from the key itself, such as `API_KEY_IP_NOT_ALLOWED`, are on the [Errors](https://docs.diamwall.com/reference/errors/) page.

## All Firewall endpoints

Each row opens the endpoint in the API reference, with every parameter, rule and response.

See the [API reference](https://docs.diamwall.com/api/#tag/firewall) for every endpoint, with parameters and responses.
