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

# Update a rule using optimistic version locking



## OpenAPI

````yaml /openapi/openapi.yaml put /banks/transaction-rules/{id}
openapi: 3.1.0
info:
  title: Tahsil API
  version: 1.0.0
  description: >-
    Tahsil müşterilerinin web ve mobil uygulamalarda kullandığı tenant-scoped
    müşteri API sözleşmesi.
servers:
  - url: https://api.tahsil.dev
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Operations - Health
    description: Public liveness and dependency readiness probes.
  - name: Identity - Auth
    description: User login, refresh and logout flows for token-based access.
  - name: Banking - Accounts
    description: Bank account aggregation endpoints available to customer tenants.
  - name: Banking - Transactions
    description: Bank transaction ingestion and retrieval endpoints.
  - name: Banking - Automation
    description: Tenant transaction matching rules, assignments and historical runs.
  - name: Banking - Polling
    description: Polling schedule definitions for bank connector queries.
  - name: Banking - Dashboard
    description: Flexible tenant dashboard analytics and widget query endpoints.
  - name: Audit - Connector Logs
    description: Customer-visible bank connector request/response audit trail.
  - name: Payments - Orchestration
    description: Tenant Virtual POS, rate plan and payment intent orchestration.
paths:
  /banks/transaction-rules/{id}:
    parameters:
      - $ref: '#/components/parameters/Id'
    put:
      tags:
        - Banking - Automation
      summary: Update a rule using optimistic version locking
      operationId: putBanksTransactionRulesById
      parameters:
        - $ref: '#/components/parameters/XCompanyIdRequired'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionRuleUpdate'
      responses:
        '200':
          $ref: '#/components/responses/ItemResponse'
        '409':
          $ref: '#/components/responses/StatusResponse'
      security:
        - bearerAuth: []
components:
  parameters:
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
    XCompanyIdRequired:
      name: x-company-id
      in: header
      required: true
      schema:
        type: string
      description: Target tenant company id for a write operation.
  schemas:
    TransactionRuleUpdate:
      type: object
      required:
        - version
      minProperties: 2
      properties:
        version:
          type: integer
          minimum: 1
        name:
          type: string
          maxLength: 120
        description:
          type:
            - string
            - 'null'
          maxLength: 500
        status:
          type: string
          enum:
            - active
            - paused
        effectiveFrom:
          type: string
          format: date-time
        conditions:
          $ref: '#/components/schemas/TransactionRuleConditionGroup'
        actions:
          type: array
          minItems: 1
          maxItems: 2
          items:
            $ref: '#/components/schemas/TransactionRuleAction'
    TransactionRuleConditionGroup:
      type: object
      required:
        - combinator
        - children
      properties:
        combinator:
          type: string
          enum:
            - all
            - any
        children:
          type: array
          minItems: 1
          maxItems: 25
          items:
            oneOf:
              - $ref: '#/components/schemas/TransactionRuleCondition'
              - $ref: '#/components/schemas/TransactionRuleConditionGroup'
    TransactionRuleAction:
      oneOf:
        - type: object
          required:
            - type
            - reference
          properties:
            id:
              type: string
              readOnly: true
            type:
              const: attach_reference
            reference:
              $ref: '#/components/schemas/ExternalReference'
        - type: object
          required:
            - type
            - values
          properties:
            id:
              type: string
              readOnly: true
            type:
              const: add_tags
            values:
              type: array
              maxItems: 20
              items:
                type: string
                maxLength: 50
    TransactionRuleCondition:
      type: object
      required:
        - field
        - operator
        - value
      properties:
        field:
          type: string
          enum:
            - bankCode
            - accountId
            - subAccountKey
            - currency
            - incoming
            - amount
            - balance
            - description
            - nameSurname
            - iban
            - idNo
            - code
            - transactionDate
            - fetchedAt
        operator:
          type: string
          enum:
            - equals
            - not_equals
            - contains
            - not_contains
            - starts_with
            - ends_with
            - in
            - exists
            - gt
            - gte
            - lt
            - lte
            - between
        value: {}
    ExternalReference:
      type: object
      required:
        - source
        - entityType
        - externalId
      properties:
        source:
          type: string
          maxLength: 64
          pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
        entityType:
          type: string
          maxLength: 64
          pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
        externalId:
          type: string
          maxLength: 256
        label:
          type:
            - string
            - 'null'
          maxLength: 200
  responses:
    ItemResponse:
      description: Single entity response
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: boolean
              result:
                type: object
                additionalProperties: true
          example:
            status: true
            result:
              id: 64f000000000000000000001
    StatusResponse:
      description: Operation completed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: boolean
          example:
            status: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

## Related topics

- [Otomasyon kuralları ve atamalar](/rehberler/otomasyon-kurallari.md)
- [Update polling schedule](/api-reference/banking--polling/update-polling-schedule.md)
- [Pause future rule evaluation](/api-reference/banking--automation/pause-future-rule-evaluation.md)
- [Resume future rule evaluation](/api-reference/banking--automation/resume-future-rule-evaluation.md)
- [Archive a rule without changing existing assignments](/api-reference/banking--automation/archive-a-rule-without-changing-existing-assignments.md)
