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

# Update Matching Policy (Beta)

> Replace the name and the value of a matching policy of the tenant the caller is acting in and return it; both fields are required. The type of a policy cannot change: `value` must have the shape of the policy's current type, otherwise the endpoint responds 422 `VALUE_TYPE_MISMATCH`. The new value applies to every identifier the policy is assigned to. Responds 422 `INVALID_MATCHING_POLICY` when the value is rejected and 403 `UNAUTHORIZED_ACCESS` when the account lacks the permission or feature required by the policy type.

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

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


## OpenAPI

````yaml firework-v4-openapi put /firework/v4/matching-policies/{policy_uuid}
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}:
    put:
      tags:
        - Matching Policies
      summary: Update a matching policy
      description: >-
        Replace the name and the value of a matching policy of the tenant the
        caller is acting in and return it; both fields are required. The type of
        a policy cannot change: `value` must have the shape of the policy's
        current type, otherwise the endpoint responds 422 `VALUE_TYPE_MISMATCH`.
        The new value applies to every identifier the policy is assigned to.
        Responds 422 `INVALID_MATCHING_POLICY` when the value is rejected and
        403 `UNAUTHORIZED_ACCESS` when the account lacks the permission or
        feature required by the policy type.
      operationId: update_matching_policy_matching_policies__policy_uuid__put
      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/UpdateMatchingPolicyBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MatchingPolicyPayload'
        '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, UNAUTHORIZED_ACCESS
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - FORBIDDEN
                          - UNAUTHORIZED_ACCESS
                      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: NOT_FOUND
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - 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
        '422':
          description: INVALID_MATCHING_POLICY, VALUE_TYPE_MISMATCH
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    properties:
                      code:
                        type: string
                        enum:
                          - INVALID_MATCHING_POLICY
                          - VALUE_TYPE_MISMATCH
                      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
components:
  schemas:
    UpdateMatchingPolicyBody:
      properties:
        name:
          type: string
          minLength: 1
          title: Name
          description: The new name of the matching policy
        value:
          $ref: '#/components/schemas/PolicyValue'
          description: The new value of the matching policy depending on its type
      type: object
      required:
        - name
        - value
      title: UpdateMatchingPolicyBody
    MatchingPolicyPayload:
      properties:
        uuid:
          type: string
          format: uuid4
          title: Uuid
          description: The UUID of the matching policy
        name:
          type: string
          title: Name
          description: The name of the matching policy
        policy_type:
          $ref: '#/components/schemas/MatchingPolicyType'
          description: The type of the matching policy
        value:
          $ref: '#/components/schemas/PolicyReadValue'
          description: The value of the matching policy depending on its type
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time the matching policy was created
        last_updated_at:
          type: string
          format: date-time
          title: Last Updated At
          description: The date and time the matching policy was last updated
      type: object
      required:
        - uuid
        - name
        - policy_type
        - value
        - created_at
        - last_updated_at
      title: MatchingPolicyPayload
    PolicyValue:
      anyOf:
        - $ref: '#/components/schemas/KeywordsValue'
        - $ref: '#/components/schemas/LuceneValue'
        - $ref: '#/components/schemas/AstpCookiesValue'
        - $ref: '#/components/schemas/AstpDomainValue'
        - $ref: '#/components/schemas/LookalikeMatchStrategiesValue'
    MatchingPolicyType:
      type: string
      enum:
        - INCLUDED_KEYWORDS
        - EXCLUDED_KEYWORDS
        - LUCENE_QUERY
        - ASTP_COOKIES
        - ASTP_DOMAIN
        - LOOKALIKE_STRATEGIES
      title: MatchingPolicyType
    PolicyReadValue:
      anyOf:
        - $ref: '#/components/schemas/KeywordsValue'
        - $ref: '#/components/schemas/LuceneValue'
        - $ref: '#/components/schemas/AstpCookiesReadValue'
        - $ref: '#/components/schemas/AstpDomainValue'
        - $ref: '#/components/schemas/LookalikeMatchStrategiesValue'
    KeywordsValue:
      properties:
        keywords:
          items:
            type: string
          type: array
          title: Keywords
          description: The keywords of the matching policy, at most 50.
      type: object
      required:
        - keywords
      title: KeywordsValue
    LuceneValue:
      properties:
        query:
          type: string
          title: Query
          description: The lucene query of the matching policy
      type: object
      required:
        - query
      title: LuceneValue
    AstpCookiesValue:
      properties:
        cookie_names:
          items:
            type: string
          type: array
          title: Cookie Names
          description: The cookie names to monitor, from 1 to 20 names
        match_subdomains:
          type: boolean
          title: Match Subdomains
          description: >-
            Whether this policy will be applied to monitor subdomains of the
            assigned domain identifiers
          default: false
      type: object
      required:
        - cookie_names
      title: AstpCookiesValue
    AstpDomainValue:
      properties:
        match_mode:
          $ref: '#/components/schemas/DomainMatchMode'
          description: >-
            The domain match mode for this policy: whether leaked credentials
            match the domain identifier on the email domain, on the
            authentication domain, or on either
          default: email_domain_only
      type: object
      title: AstpDomainValue
    LookalikeMatchStrategiesValue:
      properties:
        match_strategies:
          items:
            $ref: '#/components/schemas/Heuristic'
          type: array
          title: Match Strategies
          description: >-
            The lookalike domain match strategies to monitor: at least one, and
            `various` is not accepted
      type: object
      required:
        - match_strategies
      title: LookalikeMatchStrategiesValue
    AstpCookiesReadValue:
      properties:
        cookie_names:
          items:
            type: string
          type: array
          title: Cookie Names
          description: The cookie names to monitor, from 1 to 20 names
        match_subdomains:
          type: boolean
          title: Match Subdomains
          description: >-
            Whether this policy will be applied to monitor subdomains of the
            assigned domain identifiers
          default: false
        match_prefix:
          type: boolean
          title: Match Prefix
          description: >-
            Whether the cookie names are matched as prefixes rather than
            exactly. Read-only: it cannot be set through this API.
          default: false
      type: object
      required:
        - cookie_names
      title: AstpCookiesReadValue
    DomainMatchMode:
      type: string
      enum:
        - email_domain_only
        - auth_domain_and_email_domain
        - auth_domain_only
      title: DomainMatchMode
    Heuristic:
      type: string
      enum:
        - addition
        - bitsquatting
        - cyrillic
        - dictionary
        - ends-with
        - homoglyph
        - hyphenation
        - insertion
        - omission
        - plural
        - repetition
        - replacement
        - starts-with
        - subdomain
        - tld-swap
        - transposition
        - various
        - vowel-swap
      title: Heuristic
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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