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

# Suggest an internal-transfer rule from examples

> Derives a `BANK`-scope rule that marks transactions like the given examples as moves to the counterparty
account, strongest signal first: the counterparty account number (`HIGH` confidence), a shared prefix of
the counterparty name or remittance text (`MEDIUM`), or an amount band (`LOW`). The candidate rule is run
over the account's last 365 days so the response lists what it would match (ids capped at 500).
`unmatched_example_ids` names examples the derived rule would not catch. Nothing is saved: open the
returned rule in the editor and create it with **Create a new rule**.



## OpenAPI

````yaml /openapi/v1.json post /rules/suggest
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/suggest:
    post:
      tags:
        - Rules
      summary: Suggest an internal-transfer rule from examples
      description: >-
        Derives a `BANK`-scope rule that marks transactions like the given
        examples as moves to the counterparty

        account, strongest signal first: the counterparty account number (`HIGH`
        confidence), a shared prefix of

        the counterparty name or remittance text (`MEDIUM`), or an amount band
        (`LOW`). The candidate rule is run

        over the account's last 365 days so the response lists what it would
        match (ids capped at 500).

        `unmatched_example_ids` names examples the derived rule would not catch.
        Nothing is saved: open the

        returned rule in the editor and create it with **Create a new rule**.
      operationId: rules.suggest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SuggestRuleRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      rule:
                        type: object
                        properties:
                          scope:
                            type: string
                            const: BANK
                          trigger_on_any_condition:
                            type: boolean
                          conditions:
                            anyOf:
                              - type: array
                                prefixItems:
                                  - type: object
                                    properties:
                                      field_name:
                                        type: string
                                        const: amount
                                      operator:
                                        type: string
                                        const: GREATER_THAN_OR_EQUAL
                                      value:
                                        type: string
                                    required:
                                      - field_name
                                      - operator
                                      - value
                                  - type: object
                                    properties:
                                      field_name:
                                        type: string
                                        const: amount
                                      operator:
                                        type: string
                                        const: LESS_THAN_OR_EQUAL
                                      value:
                                        type: string
                                    required:
                                      - field_name
                                      - operator
                                      - value
                                minItems: 2
                                maxItems: 2
                              - type: array
                                prefixItems:
                                  - type: object
                                    properties:
                                      field_name:
                                        type: string
                                      operator:
                                        type: string
                                        const: STARTS_WITH
                                      value:
                                        type: string
                                    required:
                                      - field_name
                                      - operator
                                      - value
                                minItems: 1
                                maxItems: 1
                              - type: array
                                prefixItems:
                                  - type: object
                                    properties:
                                      field_name:
                                        type: string
                                      operator:
                                        type: string
                                        const: EQUALS
                                      value:
                                        type:
                                          - string
                                          - 'null'
                                    required:
                                      - field_name
                                      - operator
                                      - value
                                minItems: 1
                                maxItems: 1
                          actions:
                            type: array
                            prefixItems:
                              - type: object
                                properties:
                                  action_type:
                                    type: string
                                    const: SET_FIELD
                                  field_name:
                                    type: string
                                    const: counterparty_financial_account_id
                                  value:
                                    type: string
                                required:
                                  - action_type
                                  - field_name
                                  - value
                            minItems: 1
                            maxItems: 1
                        required:
                          - scope
                          - trigger_on_any_condition
                          - conditions
                          - actions
                      confidence:
                        type: string
                        enum:
                          - LOW
                          - MEDIUM
                          - HIGH
                      matches:
                        type: object
                        properties:
                          count:
                            type: integer
                            const: 0
                          transaction_ids:
                            type: array
                            items:
                              type: string
                            minItems: 0
                            maxItems: 0
                          lookback_days:
                            type: integer
                            const: 365
                        required:
                          - count
                          - transaction_ids
                          - lookback_days
                      unmatched_example_ids:
                        type: array
                        items:
                          type: string
                    required:
                      - rule
                      - confidence
                      - matches
                      - unmatched_example_ids
                required:
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    SuggestRuleRequest:
      type: object
      properties:
        financial_account_id:
          type: integer
          description: >-
            The account the rule will be attached to. The examples must be on
            this account.
        transaction_ids:
          type: array
          description: >-
            One to ten example transactions on that account that are moves to
            the counterparty account.
          items:
            type: integer
          minItems: 1
          maxItems: 10
          uniqueItems: true
        counterparty_financial_account_id:
          type: integer
          description: >-
            The user's own account on the other side of the move. Must differ
            from `financial_account_id`.
      required:
        - financial_account_id
        - transaction_ids
        - counterparty_financial_account_id
      title: SuggestRuleRequest
  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
    ModelNotFoundException:
      description: Not found
      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.