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

# triggers.test({ trigger, event }): runs every rule on a sample event; stores and sends nothing



## OpenAPI

````yaml /api-reference/openapi.json post /triggers/test
openapi: 3.1.0
info:
  title: paddock API
  version: 1.0.0
  description: >-
    The paddock API. Send an API key, or a session token on its own session, as
    a bearer token.
servers:
  - url: https://api.paddock.build/v1
security:
  - bearer: []
paths:
  /triggers/test:
    post:
      summary: >-
        triggers.test({ trigger, event }): runs every rule on a sample event;
        stores and sends nothing
      operationId: testTrigger
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggerTestRequest'
      responses:
        '200':
          description: Each rule''s result
          headers:
            Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriggerTest'
        default:
          $ref: '#/components/responses/Error'
components:
  schemas:
    TriggerTestRequest:
      type: object
      additionalProperties: false
      required:
        - trigger
        - event
      properties:
        trigger:
          $ref: '#/components/schemas/TriggerCreate'
        event:
          $ref: '#/components/schemas/TestEvent'
    TriggerTest:
      type: object
      required:
        - dedupe
        - rules
      properties:
        dedupe:
          type: object
          required:
            - source
            - value
          properties:
            source:
              $ref: '#/components/schemas/DedupeSource'
            value:
              type:
                - string
                - 'null'
              description: The expression's value; null for the body's hash.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/RuleTest'
    TriggerCreate:
      type: object
      additionalProperties: false
      required:
        - name
      properties:
        name:
          type: string
        verification:
          oneOf:
            - $ref: '#/components/schemas/VerificationCreate'
            - type: 'null'
        dedupe:
          type:
            - string
            - 'null'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/RuleCreate'
        secret:
          description: 16 to 256 printable ASCII characters; generated when omitted.
          type: string
    TestEvent:
      description: A sample request.
      type: object
      additionalProperties: false
      required:
        - body
      properties:
        body:
          description: Any JSON value.
        headers:
          type: object
          additionalProperties:
            type: string
        query:
          type: object
          additionalProperties:
            type: string
    DedupeSource:
      type: string
      enum:
        - expression
        - body
    RuleTest:
      type: object
      required:
        - rule
        - enabled
        - matched
        - error
        - sessionKey
        - message
        - missing
      properties:
        rule:
          type: string
        enabled:
          description: A disabled rule is reported but never evaluated.
          type: boolean
        matched:
          description: null when disabled or when the filter failed.
          type:
            - boolean
            - 'null'
        error:
          oneOf:
            - $ref: '#/components/schemas/OutcomeError'
            - type: 'null'
        sessionKey:
          type:
            - string
            - 'null'
          description: >-
            The rendered key; the delivery's ID and the rule's name stand in for
            mode new.
        message:
          type:
            - string
            - 'null'
        missing:
          description: Message paths that led nowhere.
          type: array
          items:
            type: string
    ErrorBody:
      description: The body of every non-2xx response.
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    VerificationCreate:
      type: object
      additionalProperties: false
      required:
        - header
      properties:
        header:
          type: string
        prefix:
          description: Default "".
          type: string
    RuleCreate:
      type: object
      additionalProperties: false
      required:
        - name
        - agentId
        - session
        - message
      properties:
        name:
          type: string
        enabled:
          description: Default true.
          type: boolean
        filter:
          type:
            - string
            - 'null'
        agentId:
          type: string
        session:
          $ref: '#/components/schemas/SessionChoice'
        sessionSettings:
          $ref: '#/components/schemas/SessionSettings'
        message:
          type: string
    OutcomeError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/OutcomeErrorCode'
        message:
          type: string
    ErrorObject:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
        details:
          type: object
    SessionChoice:
      oneOf:
        - $ref: '#/components/schemas/SessionKeyChoice'
        - $ref: '#/components/schemas/SessionNewChoice'
    SessionSettings:
      description: >-
        As agent.sessions.create takes them, literal; used only when a session
        is created. triggerKey is set by the rule and refused in metadata.
      type: object
      additionalProperties: false
      properties:
        cwd:
          type: string
        systemPrompt:
          type: string
        metadata:
          $ref: '#/components/schemas/Metadata'
    OutcomeErrorCode:
      type: string
      enum:
        - filter_error
        - template_error
        - agent_not_found
        - unavailable
        - internal
    ErrorCode:
      type: string
      enum:
        - invalid_request
        - unauthorized
        - forbidden
        - not_found
        - conflict
        - payload_too_large
        - unsupported
        - unavailable
        - internal
    SessionKeyChoice:
      description: >-
        The session whose triggerKey metadata is the rendered key, found or
        created.
      type: object
      additionalProperties: false
      required:
        - mode
        - key
      properties:
        mode:
          const: key
        key:
          description: >-
            A template: plain text with {{path}} placeholders that place values
            from the event.
          type: string
    SessionNewChoice:
      description: A new session per event.
      type: object
      additionalProperties: false
      required:
        - mode
      properties:
        mode:
          const: new
    Metadata:
      description: The customer's own string keys and values; never case-converted.
      type: object
      additionalProperties:
        type: string
  headers:
    RequestId:
      description: The request's ID, for support and logs
      schema:
        type: string
  responses:
    Error:
      description: Every non-2xx response
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key, or a session token on its own session

````

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