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

# Preview a rule against transactions (dry-run)

> Accepts either a `rule_id` to load an existing rule, or an inline `rule`
definition (conditions + actions). Provide an array of `transaction_ids`
to test against — each transaction must belong to the authenticated user.
No data is persisted.

Action values support **Liquid templates** for dynamic expressions.
Use `{{ transaction.field_name }}` to reference fields and Liquid filters
(`remove`, `regex_capture`, `date_add`, `remove_at`, `keep_at`, etc.)
to transform values. Plain strings are treated as literal values.



## OpenAPI

````yaml /openapi/v1.json post /rules/preview
openapi: 3.2.0
info:
  title: Synci
  version: '1.0'
  description: >-
    Synci is a platform for integrating financial accounts with your favorite
    apps.
servers:
  - url: https://api.synci.io/api/v1
security:
  - oauth2: []
  - http: []
tags:
  - name: Finance
    kind: nav
  - name: Connections
    parent: Finance
  - name: Accounts
    parent: Finance
  - name: Transactions
    parent: Finance
  - name: Institutions
    parent: Finance
  - name: Destinations
    kind: nav
  - name: YNAB
    parent: Destinations
  - name: Lunch Money
    parent: Destinations
  - name: Google Sheets
    parent: Destinations
  - name: SimpleFIN
    parent: Destinations
  - name: Notion
    parent: Destinations
  - name: Account
    kind: nav
  - name: Webhooks
    parent: Account
  - name: User
    parent: Account
  - name: rule-engine
    summary: Rules
    kind: nav
  - name: Rules
    parent: rule-engine
  - name: Rule Logs
    parent: rule-engine
  - name: Transfers
    kind: nav
  - name: Transfer Links
    parent: Transfers
  - name: Transfer Logs
    parent: Transfers
paths:
  /rules/preview:
    post:
      tags:
        - Rules
      summary: Preview a rule against transactions (dry-run)
      description: >-
        Accepts either a `rule_id` to load an existing rule, or an inline `rule`

        definition (conditions + actions). Provide an array of `transaction_ids`

        to test against — each transaction must belong to the authenticated
        user.

        No data is persisted.


        Action values support **Liquid templates** for dynamic expressions.

        Use `{{ transaction.field_name }}` to reference fields and Liquid
        filters

        (`remove`, `regex_capture`, `date_add`, `remove_at`, `keep_at`, etc.)

        to transform values. Plain strings are treated as literal values.
      operationId: rules.preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewRuleRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        transaction_id:
                          type: string
                        conditions_matched:
                          type: boolean
                        transaction_summary:
                          type: object
                          properties:
                            payee:
                              type:
                                - string
                                - 'null'
                            payee_logo:
                              type:
                                - string
                                - 'null'
                            amount:
                              type: string
                            currency:
                              type: string
                            date:
                              type:
                                - string
                                - 'null'
                            description:
                              type: string
                          required:
                            - payee
                            - payee_logo
                            - amount
                            - currency
                            - date
                            - description
                        changes:
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type: string
                              before:
                                type:
                                  - string
                                  - 'null'
                              after:
                                type: string
                            required:
                              - field
                              - before
                              - after
                        error:
                          type: string
                      required:
                        - transaction_id
                        - conditions_matched
                        - transaction_summary
                        - changes
                        - error
                  missing_transaction_ids:
                    type: array
                    items: {}
                required:
                  - results
                  - missing_transaction_ids
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    PreviewRuleRequest:
      type: object
      properties:
        rule_id:
          type:
            - integer
            - 'null'
          description: >-
            The ID of an existing rule to preview. Omit to provide an inline
            rule definition instead.
        rule:
          type: object
          description: Inline rule definition (required when rule_id is absent)
          properties:
            trigger_on_any_condition:
              type:
                - boolean
                - 'null'
            conditions:
              type:
                - array
                - 'null'
              items:
                type: object
                properties:
                  field_name:
                    type: string
                  operator:
                    $ref: '#/components/schemas/RuleOperatorEnum'
                  value:
                    type:
                      - string
                      - 'null'
                    maxLength: 10000
                  transaction_type:
                    anyOf:
                      - $ref: '#/components/schemas/TransactionTypeEnum'
                      - type: 'null'
              maxItems: 10
            actions:
              type: array
              items:
                type: object
                properties:
                  action_type:
                    $ref: '#/components/schemas/RuleActionTypeEnum'
                  field_name:
                    type:
                      - string
                      - 'null'
                  value:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Action value. Supports Liquid templates, e.g. `{{
                      transaction.creditor.name | remove: "PREFIX " }}`.
                    maxLength: 10000
                  order:
                    type:
                      - integer
                      - 'null'
                required:
                  - action_type
              maxItems: 10
        transaction_ids:
          type: array
          description: >-
            The IDs of the transactions to preview the rule against. The
            transactions must belong to the authenticated user. Maximum 25 per
            request.
          items:
            type: string
          minItems: 1
          maxItems: 25
      required:
        - rule
        - transaction_ids
      title: PreviewRuleRequest
    RuleOperatorEnum:
      type: string
      description: >
        The comparison operator a rule condition uses to compare a transaction
        field against the condition's value.
      enum:
        - EQUALS
        - DOES_NOT_EQUAL
        - CONTAINS
        - DOES_NOT_CONTAIN
        - STARTS_WITH
        - DOES_NOT_START_WITH
        - ENDS_WITH
        - DOES_NOT_END_WITH
        - GREATER_THAN
        - GREATER_THAN_OR_EQUAL
        - LESS_THAN
        - LESS_THAN_OR_EQUAL
        - MATCHES_REGEX
      title: RuleOperatorEnum
    TransactionTypeEnum:
      type: string
      enum:
        - BANK
        - YNAB
      title: TransactionTypeEnum
    RuleActionTypeEnum:
      type: string
      description: >-
        The kind of change a rule action performs when the rule's conditions are
        met.

        | |

        |---|

        | `SET_DESTINATION_FIELD` <br/> Set a destination transaction field,
        resolved against the attached transfer link's destination. Only
        available for transfer rules. |

        | `SET_OUTPUT_FIELD` <br/> Set a canonical transaction field on the
        outgoing copy, read by canonical-output channels (spreadsheet
        destinations today). Only available for transfer rules. |

        | `SET_YNAB_FIELD` <br/> Set a field on the YNAB transaction. Legacy
        alias of SET_DESTINATION_FIELD with a YNAB field. |

        | `SET_LUNCH_MONEY_FIELD` <br/> Set a field on the Lunch Money
        transaction. Legacy alias of SET_DESTINATION_FIELD with a Lunch Money
        field. |

        | `SET_FIELD` <br/> Set a field on the transaction. |

        | `CHANGE_YNAB_FIELD` <br/>  |

        | `APPLY_REGEX` <br/>  |

        | `STOP_TRANSFER` <br/> Prevent the transaction from being transferred
        to the destination. Only available for transfer link rules. |
      enum:
        - SET_DESTINATION_FIELD
        - SET_OUTPUT_FIELD
        - SET_YNAB_FIELD
        - SET_LUNCH_MONEY_FIELD
        - SET_FIELD
        - CHANGE_YNAB_FIELD
        - APPLY_REGEX
        - STOP_TRANSFER
      title: RuleActionTypeEnum
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.synci.io/oauth/authorize
          tokenUrl: https://api.synci.io/oauth/token
          scopes:
            profile:read: View your name, email, and profile details
            accounts:read: View your connected financial accounts and balances
            accounts:write: >-
              Update, sync, and remove your financial accounts, and change their
              settings
            transactions:read: View your transactions
            transactions:write: Create, update, and delete your transactions
            sensitive:read: >-
              See sensitive identifiers like account numbers and account holder
              names
            transfer-links:read: View your transfer links and their transfer history
            transfer-links:write: Create, update, and delete transfer links, and undo transfers
            rules:read: View your rules and rule activity
            rules:write: Create, update, and delete rules, and undo rule actions
            webhooks:read: View your webhook endpoints
            webhooks:write: >-
              Create, update, and delete webhook endpoints, and rotate their
              secrets
            destinations:read: View your connected destinations
            destinations:write: Connect, update, and remove destinations
            financial-connections:read: View your connected institutions
            financial-connections:write: Manage your connected institutions
    http:
      type: http
      description: Bearer token (personal access token or OAuth access token)
      scheme: bearer

````

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