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

# Dry-run a pattern rule

> How many profiles would get the pattern over the last 90 days, with a sample and evidence.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/traits/rules/dry-run
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-1
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/traits/rules/dry-run:
    post:
      tags:
        - operate
      summary: Dry-run a pattern rule
      description: >-
        Tests a pattern rule from the catalog, with your parameters, against the
        last 90 days before you turn it on: how many profiles were evaluated,
        how many would get the pattern, and a pseudonymous sample with the
        evidence and the expiry of each one. Nothing is written to the memory.


        **Authentication.** Console person token with the `integration`,
        `analysis` role (or admin), or a source key with the `admin` scope.
      operationId: dry_run_trait_rule_v1_traits_rules_dry_run_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TraitRuleDraft'
            example:
              rule_id: recurring-visit-complaint
              catalog: recurring_complaint
              params:
                category: technician_visit
                min_count: 3
                window_days: 90
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraitDryRunResponse'
              example:
                rule_id: recurring-visit-complaint
                window_days: 90
                profiles_evaluated: 48210
                profiles_matching: 312
                sample:
                  - profile_id: 0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03
                    pseudonym: psn_7f3a
                    value: Third complaint about technician visit in 90 days
                    expires_at: '2026-11-02T17:02:11Z'
                    evidence:
                      - kind: episode
                        id: 0192f7a3-7c32-7b0c-9e16-5b8a0f1c2d34
          description: How many profiles would match, with a sample.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    TraitRuleDraft:
      additionalProperties: false
      description: A catalog rule with tenant parameters; the dry-run never stores it.
      properties:
        catalog:
          enum:
            - recurring_complaint
            - broken_company_promise
            - asked_to_cancel
            - preferred_channel
            - does_not_answer_calls
            - escalated_to_human
            - declining_sentiment
            - overdue_invoices
          title: Catalog
          type: string
        params:
          additionalProperties: true
          title: Params
          type: object
        rule_id:
          pattern: ^[a-z][a-z0-9_.:-]{0,63}$
          title: Rule Id
          type: string
        version:
          default: draft
          title: Version
          type: string
      required:
        - rule_id
        - catalog
      title: TraitRuleDraft
      type: object
    TraitDryRunResponse:
      additionalProperties: false
      properties:
        profiles_evaluated:
          title: Profiles Evaluated
          type: integer
        profiles_matching:
          title: Profiles Matching
          type: integer
        rule_id:
          title: Rule Id
          type: string
        sample:
          items:
            $ref: '#/components/schemas/TraitSample'
          title: Sample
          type: array
        window_days:
          title: Window Days
          type: integer
      required:
        - rule_id
        - window_days
        - profiles_evaluated
        - profiles_matching
        - sample
      title: TraitDryRunResponse
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    TraitSample:
      additionalProperties: false
      properties:
        evidence:
          items:
            $ref: '#/components/schemas/EvidencePointer'
          title: Evidence
          type: array
        expires_at:
          format: date-time
          title: Expires At
          type: string
        profile_id:
          title: Profile Id
          type: string
        pseudonym:
          title: Pseudonym
          type: string
        value:
          title: Value
          type: string
      required:
        - profile_id
        - pseudonym
        - value
        - expires_at
        - evidence
      title: TraitSample
      type: object
    EvidencePointer:
      additionalProperties: false
      properties:
        id:
          title: Id
          type: string
        kind:
          title: Kind
          type: string
      required:
        - kind
        - id
      title: EvidencePointer
      type: object
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````