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

# Set filtering rules

> Creates or updates filtering rules for an environment in bulk. This action will overwrite any existing filtering rules on specified environment. If there is no filtering rules for an environment, this action creates them. To completely remove filtering rules, set both `allow` and `deny` lists to an empty array (`[]`).
Currently only supports origin domain filtering.

Note: It can take up to 5 minutes to start filtering incoming requests after setting a rule.



## OpenAPI

````yaml reference/management-api_2024-05-20.json POST /filtering-rules
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: '2024-05-20'
  contact: {}
servers:
  - url: https://management-api.fpjs.io
security:
  - Management-API-key: []
tags: []
paths:
  /filtering-rules:
    post:
      tags:
        - filtering-rules
      summary: Set filtering rules
      description: >-
        Creates or updates filtering rules for an environment in bulk. This
        action will overwrite any existing filtering rules on specified
        environment. If there is no filtering rules for an environment, this
        action creates them. To completely remove filtering rules, set both
        `allow` and `deny` lists to an empty array (`[]`).

        Currently only supports origin domain filtering.


        Note: It can take up to 5 minutes to start filtering incoming requests
        after setting a rule.
      operationId: FilteringRulesController_create
      parameters:
        - name: X-API-Version
          in: header
          description: Management API version.
          example: '2024-05-20'
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFilteringRuleDtoV1'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/bd4735b2481c60fd3ef4b'
        '400':
          description: 'Error: Filtering rules can''t be set due to validation errors.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationApiExceptionDto'
        '401':
          description: 'Error: Invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiExceptionDto'
        '429':
          description: 'Error: API key has exceeded its rate limit.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiExceptionDto'
components:
  schemas:
    CreateFilteringRuleDtoV1:
      type: object
      properties:
        environment:
          type: string
          description: Environment for which to set filtering rule.
        allow:
          description: >-
            List of origin domains that are allowed to make requests, making all
            other domains denied by default. When setting the allow list, you
            must explicitly set the deny list to wildcard value (`['*']`).
          type: array
          items:
            type: string
        deny:
          description: >-
            List of origin domains that are denied to make requests, making all
            other domains allowed by default. When setting the deny list, you
            must explicitly set the allow list to wildcard value (`['*']`).
          type: array
          items:
            type: string
      required:
        - environment
        - allow
        - deny
    bd4735b2481c60fd3ef4b:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/FilteringRulesResponseDtoV1'
      required:
        - data
    ValidationApiExceptionDto:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/BaseValidationApiExceptionDto'
      required:
        - error
    ApiExceptionDto:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/BaseApiExceptionDto'
      required:
        - error
    FilteringRulesResponseDtoV1:
      type: object
      properties:
        type:
          type: string
          enum:
            - origin
          description: Type of filtering rule.
          example: origin
        environment:
          type: string
          description: ID of an environment the filtering rule allies to.
          example: ae_rrETjdWcfqI6AFsk
        allow:
          description: >-
            List of origin domains that are allowed to make API requests.
            Wildcard entry (`*`) implies all domains are allowed.
          example:
            - example.com
            - my-website.com
          type: array
          items:
            type: string
        deny:
          description: >-
            List of origin domains that are denied from making API requests.
            Wildcard entry (`*`) implies all domains are denied.
          example:
            - '*'
          type: array
          items:
            type: string
      required:
        - type
        - environment
        - allow
        - deny
    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

````