---
title: "Test filtering rules"
method: POST
path: "/filtering-rules/test"
tags: ["filtering-rules"]
---

# Test filtering rules

`POST /filtering-rules/test`

Tests filtering rules against a specified request ID or custom event payload. You can provide an existing request ID (up to 3 months old) or a custom JSON payload. Optionally, you can provide custom rules to test instead of using existing rules.

## Headers

- `X-API-Version` string, required

## Request body

- TestFilteringRulesDtoV2
  - `rules` TestRuleDto[] — Array of rules to test. If omitted, provide environment ID to test against existing rules.
    - `expression` string, required — Expression in expr-lang format that defines the rule condition
    - `action` 'allow' | 'deny', required — Action to take when the rule matches
    - `deny_with` 'Forbidden' — Error message to return when denying a request
  - `environment` string — Environment ID. Must be provided if rules are not
  - `test_request_id` string — Request ID to test against (up to 3 months old)
  - `test_request_payload` TestPayloadDto
    - `headers` object — Request headers as key-value pairs with array values
    - `ip` string — IP address of the request
    - `userAgent` string — User agent string
    - `sdkPlatform` 'js' | 'android' | 'ios' — SDK platform
    - `sdkVersion` string — SDK version
    - `appPackageName` string — Application package name

## Response `200`

Test results showing which rule was triggered (if any) and the resulting action.

- 6818c770704cb8ff0d6ec
  - `data` TestFilteringRulesResponseDtoV2, required
    - `result` 'allow' | 'deny', required — Result of the test
    - `deny_with` string, nullable, required — Error message if request was denied
    - `triggered_rule` string, nullable, required — Expression of the triggered rule

## 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)
