> ## 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 trigger rule

> How many firings the rule would have had over the last 30 days, with a sample.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/triggers/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/triggers/dry-run:
    post:
      tags:
        - operate
      summary: Dry-run a trigger rule
      description: >-
        Tests a trigger rule against the last 30 days before you turn it on: how
        many subjects were evaluated, how many times it would fire, and a sample
        with the evidence. It also checks that the target endpoint may receive
        what the rule sends; `target_problem` says why not. Nothing is sent.


        **Authentication.** Console person token with the `integration` role (or
        admin), or a source key with the `admin` scope.
      operationId: dry_run_trigger_rule_v1_triggers_dry_run_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggerRuleDraft'
            example:
              rule_id: overdue-visit
              condition: promise.overdue
              params:
                days: 1
              endpoint_id: whe_crm
              window_hours: 24
              late_policy: deliver_marked
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriggerDryRunResponse'
              example:
                rule_id: overdue-visit
                window_days: 30
                subjects_evaluated: 48210
                would_fire: 214
                target_problem: null
                sample:
                  - subject_id: 0192f7a0-3b2e-7d41-8c5a-2e9f4b7a1c03
                    pseudonym: psn_7f3a
                    evidence:
                      - kind: open_item
                        id: oi_01J8ZK
          description: How many firings the rule would have had, 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:
    TriggerRuleDraft:
      additionalProperties: false
      properties:
        condition:
          enum:
            - promise.overdue
            - open_item.due
            - trait.present
            - sentiment.drop
            - identity.ambiguous
            - fact.contradicted_by_system_event
            - recontact
            - context_use.repetition_rate
            - source.silent
          title: Condition
          type: string
        endpoint_id:
          title: Endpoint Id
          type: string
        late_policy:
          default: deliver_marked
          enum:
            - deliver_marked
            - suppress
          title: Late Policy
          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
        window_hours:
          default: 24
          maximum: 2160
          minimum: 1
          title: Window Hours
          type: integer
      required:
        - rule_id
        - condition
        - endpoint_id
      title: TriggerRuleDraft
      type: object
    TriggerDryRunResponse:
      additionalProperties: false
      properties:
        rule_id:
          title: Rule Id
          type: string
        sample:
          items:
            $ref: '#/components/schemas/TriggerSample'
          title: Sample
          type: array
        subjects_evaluated:
          title: Subjects Evaluated
          type: integer
        target_problem:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Why the target endpoint could not receive this rule's payload, if it
            cannot.
          title: Target Problem
        window_days:
          title: Window Days
          type: integer
        would_fire:
          title: Would Fire
          type: integer
      required:
        - rule_id
        - window_days
        - subjects_evaluated
        - would_fire
        - sample
      title: TriggerDryRunResponse
      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
    TriggerSample:
      additionalProperties: false
      properties:
        evidence:
          items:
            $ref: '#/components/schemas/EvidencePointer'
          title: Evidence
          type: array
        pseudonym:
          anyOf:
            - type: string
            - type: 'null'
          title: Pseudonym
        subject_id:
          title: Subject Id
          type: string
      required:
        - subject_id
        - evidence
      title: TriggerSample
      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

````