> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fingerprint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test filtering rules

> 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.



## OpenAPI

````yaml reference/management-api_2025-11-20.json POST /filtering-rules/test
openapi: 3.0.0
info:
  title: Management API
  description: >-
    Managment API allows you to manage your Fingerprint account and applications
    programmatically from a server environment.
  version: '2025-11-20'
  contact: {}
servers:
  - url: https://management-api.fpjs.io
security:
  - Management-API-key: []
tags: []
paths:
  /filtering-rules/test:
    post:
      tags:
        - filtering-rules
      summary: Test filtering rules
      description: >-
        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.
      operationId: FilteringRulesV2Controller_test
      parameters:
        - name: X-API-Version
          in: header
          description: Management API version.
          example: '2025-11-20'
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestFilteringRulesDtoV2'
      responses:
        '200':
          description: >-
            Test results showing which rule was triggered (if any) and the
            resulting action.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/6818c770704cb8ff0d6ec'
        '400':
          description: 'Error: Bad request.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationApiExceptionDto'
        '401':
          description: 'Error: Invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiExceptionDto'
        '403':
          description: Forbidden. Insufficient permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiExceptionDto'
        '422':
          description: 'Error: Payload parameters are invalid.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationApiExceptionDto'
        '429':
          description: 'Error: API key has exceeded its rate limit.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiExceptionDto'
components:
  schemas:
    TestFilteringRulesDtoV2:
      type: object
      properties:
        rules:
          description: >-
            Array of rules to test. If omitted, provide environment ID to test
            against existing rules.
          type: array
          items:
            $ref: '#/components/schemas/TestRuleDto'
        environment:
          type: string
          description: Environment ID. Must be provided if rules are not
          example: ae_rrETjdWcfqI6AFsk
        test_request_id:
          type: string
          description: Request ID to test against (up to 3 months old)
          example: req_abc123xyz
        test_request_payload:
          description: Request data to test against
          allOf:
            - $ref: '#/components/schemas/TestPayloadDto'
    6818c770704cb8ff0d6ec:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/TestFilteringRulesResponseDtoV2'
      required:
        - data
    ValidationApiExceptionDto:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/BaseValidationApiExceptionDto'
      required:
        - error
    ApiExceptionDto:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/BaseApiExceptionDto'
      required:
        - error
    TestRuleDto:
      type: object
      properties:
        expression:
          type: string
          description: Expression in expr-lang format that defines the rule condition
          example: http.request.ip in cidr('192.168.1.1/32')
        action:
          type: string
          enum:
            - allow
            - deny
          description: Action to take when the rule matches
          example: deny
        deny_with:
          type: string
          enum:
            - Forbidden
          description: Error message to return when denying a request
          example: Forbidden
      required:
        - expression
        - action
    TestPayloadDto:
      type: object
      properties:
        headers:
          type: object
          description: Request headers as key-value pairs with array values
          example:
            user-agent:
              - Mozilla/5.0
            accept:
              - application/json
        ip:
          type: string
          description: IP address of the request
          example: 192.168.1.1
        userAgent:
          type: string
          description: User agent string
          example: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
        sdkPlatform:
          type: string
          enum:
            - js
            - android
            - ios
          description: SDK platform
          example: js
        sdkVersion:
          type: string
          description: SDK version
          example: 3.8.0
        appPackageName:
          type: string
          description: Application package name
          example: com.example.app
    TestFilteringRulesResponseDtoV2:
      type: object
      properties:
        result:
          type: string
          enum:
            - allow
            - deny
          description: Result of the test
          example: deny
        deny_with:
          type: string
          nullable: true
          description: Error message if request was denied
          example: Forbidden
        triggered_rule:
          type: string
          nullable: true
          description: Expression of the triggered rule
          example: http.request.ip in cidr('192.168.1.1/32')
      required:
        - result
        - deny_with
        - triggered_rule
    BaseValidationApiExceptionDto:
      type: object
      properties:
        message:
          type: string
          description: Verbal description of the error.
        code:
          type: string
          description: Error code.
        violations:
          description: List of validation violations.
          type: array
          items:
            $ref: '#/components/schemas/BaseValidationApiExceptionViolationDto'
      required:
        - message
        - code
    BaseApiExceptionDto:
      type: object
      properties:
        message:
          type: string
          description: Verbal description of the error.
        code:
          type: string
          description: Error code.
      required:
        - message
        - code
    BaseValidationApiExceptionViolationDto:
      type: object
      properties:
        property:
          type: string
          description: Property that has failed validation.
        message:
          type: string
          description: Description of the violation.
      required:
        - property
        - message
  securitySchemes:
    Management-API-key:
      scheme: bearer
      bearerFormat: JWT
      type: http

````