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

# Assign Policy (Beta)

> Assign a matching policy to one or more identifiers of the tenant the caller is acting in; responds 201 with an empty body on success. The request is applied to all the identifiers or to none: it fails with 404 `IDENTIFIER_NOT_FOUND` when an identifier does not exist in the tenant, 400 `INCOMPATIBLE_IDENTIFIER_TYPE` when the policy type does not support the type of an identifier (`ASTP_COOKIES` and `ASTP_DOMAIN` policies only apply to domain identifiers), 400 `TOO_MANY_MATCHING_POLICIES` when an identifier already has 10 matching policies, and 409 `MATCHING_POLICY_ALREADY_ASSIGNED` when the policy is already assigned to one of the identifiers.

&#x20;Required API key permission: **Write Tenant**

> [!NOTE]
>
> The Assign Policy endpoint is still in beta and is subject to change.


## OpenAPI

````yaml firework-v4-openapi post /firework/v4/matching-policies/{policy_uuid}/assignments
openapi: 3.1.0
info:
  title: Firework API
  version: v4
servers:
  - url: https://api.flare.io
security:
  - BearerAuth: []
tags:
  - name: Audit Logs
    description: Audit trail of actions performed in the platform.
  - name: Credentials
    description: >-
      Leaked credentials: search across all sources or within a tenant, and
      remediate or ignore them.
  - name: Entities
    description: >-
      Threat intelligence entities such as actors, chat channels, forum threads
      and domains, and the relations between them.
  - name: Events
    description: >-
      Events collected by Flare: global search, tenant and identifier feeds,
      event details, actions and saved feed views.
  - name: Identifiers
    description: >-
      Identifiers are the assets a tenant monitors, such as domains, keywords
      and email addresses. Includes recommendations and authorization of
      sensitive identifiers.
  - name: Matching Policies
    description: >-
      Matching policies refine which events match identifiers. Manage policies
      and their assignment to identifiers.
  - name: Sandbox
    description: File uploads and their sandbox analysis.
  - name: Threat Flow
    description: >-
      Threat Flow intelligence requests, generated reports and conversation
      summaries.
paths:
  /firework/v4/matching-policies/{policy_uuid}/assignments:
    post:
      tags:
        - Matching Policies
      summary: Assign a matching policy to identifiers
      description: >-
        Assign a matching policy to one or more identifiers of the tenant the
        caller is acting in; responds 201 with an empty body on success. The
        request is applied to all the identifiers or to none: it fails with 404
        `IDENTIFIER_NOT_FOUND` when an identifier does not exist in the tenant,
        400 `INCOMPATIBLE_IDENTIFIER_TYPE` when the policy type does not support
        the type of an identifier (`ASTP_COOKIES` and `ASTP_DOMAIN` policies
        only apply to domain identifiers), 400 `TOO_MANY_MATCHING_POLICIES` when
        an identifier already has 10 matching policies, and 409
        `MATCHING_POLICY_ALREADY_ASSIGNED` when the policy is already assigned
        to one of the identifiers.
      operationId: assign_policy_matching_policies__policy_uuid__assignments_post
      parameters:
        - name: policy_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: UUID of the matching policy.
            title: Policy Uuid
          description: UUID of the matching policy.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PolicyAssignmentsBody'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '400':
          description: INCOMPATIBLE_IDENTIFIER_TYPE, TOO_MANY_MATCHING_POLICIES
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - INCOMPATIBLE_IDENTIFIER_TYPE
                          - TOO_MANY_MATCHING_POLICIES
                      data:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        title: Data
                      message:
                        anyOf:
                          - type: string
                          - items: {}
                            type: array
                          - type: 'null'
                        title: Message
                    required:
                      - code
                      - data
                      - message
                    title: HTTPError
                    type: object
                required:
                  - error
        '401':
          description: UNAUTHORIZED
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - UNAUTHORIZED
                      data:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        title: Data
                      message:
                        anyOf:
                          - type: string
                          - items: {}
                            type: array
                          - type: 'null'
                        title: Message
                    required:
                      - code
                      - data
                      - message
                    title: HTTPError
                    type: object
                required:
                  - error
        '403':
          description: FORBIDDEN
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - FORBIDDEN
                      data:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        title: Data
                      message:
                        anyOf:
                          - type: string
                          - items: {}
                            type: array
                          - type: 'null'
                        title: Message
                    required:
                      - code
                      - data
                      - message
                    title: HTTPError
                    type: object
                required:
                  - error
        '404':
          description: IDENTIFIER_NOT_FOUND, NOT_FOUND
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - IDENTIFIER_NOT_FOUND
                          - NOT_FOUND
                      data:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        title: Data
                      message:
                        anyOf:
                          - type: string
                          - items: {}
                            type: array
                          - type: 'null'
                        title: Message
                    required:
                      - code
                      - data
                      - message
                    title: HTTPError
                    type: object
                required:
                  - error
        '409':
          description: MATCHING_POLICY_ALREADY_ASSIGNED
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - MATCHING_POLICY_ALREADY_ASSIGNED
                      data:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        title: Data
                      message:
                        anyOf:
                          - type: string
                          - items: {}
                            type: array
                          - type: 'null'
                        title: Message
                    required:
                      - code
                      - data
                      - message
                    title: HTTPError
                    type: object
                required:
                  - error
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PolicyAssignmentsBody:
      properties:
        identifier_ids:
          items:
            type: integer
          type: array
          title: Identifier Ids
          description: >-
            The IDs of the identifiers to assign the policy to or to unassign it
            from
        clean_past_events:
          type: boolean
          title: Clean Past Events
          description: >-
            Whether this policy will be applied to historical events; ignored
            when unassigning
          default: false
      type: object
      required:
        - identifier_ids
      title: PolicyAssignmentsBody
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.