---
title: "Create filtering rule"
method: POST
path: "/filtering-rules"
tags: ["filtering-rules"]
---

# Create filtering rule

`POST /filtering-rules`

Creates a new filtering rule. The rule will be evaluated in order based on the placement parameter. If no placement is specified, the rule is added to the end.

## Headers

- `X-API-Version` string, required

## Request body

- BaseFilteringRuleDto
  - `name` string, required — Name of the filtering rule
  - `environment` string, required — Environment ID
  - `expression` string, required — Expression in expr-lang format that defines the rule condition
  - `action` 'allow' | 'deny', required — Action to take when the rule matches
  - `status` 'enabled' | 'disabled' — Status of the filtering rule
  - `deny_with` 'Forbidden' — Error message to return when denying a request
  - `placement` PlacementDto
    - `position` number — Position index to insert the rule at
    - `after` string — ID of the rule to insert after
    - `before` string — ID of the rule to insert before

## Response `201`

Created filtering rule object.

- 376818c770704cb8ff0d6
  - `data` FilteringRuleResponseDtoV2, required
    - `id` string, required — Auto-generated ID for the filtering rule
    - `name` string, required — Name of the filtering rule
    - `environment` string, required — Environment ID the rule belongs to
    - `expression` string, required — Expression in expr-lang format that defines the rule condition
    - `action` 'allow' | 'deny', required — Action to take when the rule matches
    - `status` 'enabled' | 'disabled', required — Status of the filtering rule
    - `deny_with` string, nullable — Error message to return when denying a request
    - `created_at` string, date-time, required — Date when the rule was created
    - `updated_at` string, date-time, nullable — Date when the rule was last updated

## Other responses

- `400` — Error: Bad request.
- `401` — Error: Invalid API key.
- `403` — Forbidden. Insufficient permissions.
- `422` — Error: Payload parameters are invalid.
- `429` — Error: API key has exceeded its rate limit.

---

[API](https://skmtc.dev/fingerprint/apis/management-api.md) · [All operations](https://skmtc.dev/fingerprint/apis/management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fingerprint/management-api/revisions/b17eccec9d47/schema)
