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

# Update a transaction for a bank account

> The amount is changed with `amount` (+ optional `direction`) or with raw `debit`/`credit`. Changing
`type` to one with a fixed direction (collection: debit; payment, bank commission: credit) moves the
amount to that side. A transaction recorded against a patient only accepts `description`,
`invoice_number`, `payment_method` and `transaction_date`; anything else is refused with
`PAIRED_TRANSACTION_IMMUTABLE`.



## OpenAPI

````yaml put /v1/bank-accounts/{accountId}/transactions/{transactionId}
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/bank-accounts/{accountId}/transactions/{transactionId}:
    put:
      tags:
        - AccountTransaction
      summary: Update a transaction for a bank account
      description: >-
        The amount is changed with `amount` (+ optional `direction`) or with raw
        `debit`/`credit`. Changing

        `type` to one with a fixed direction (collection: debit; payment, bank
        commission: credit) moves the

        amount to that side. A transaction recorded against a patient only
        accepts `description`,

        `invoice_number`, `payment_method` and `transaction_date`; anything else
        is refused with

        `PAIRED_TRANSACTION_IMMUTABLE`.
      operationId: accountTransaction.update
      parameters:
        - name: accountId
          in: path
          required: true
          description: The bank account identifier
          schema:
            type: integer
        - name: transactionId
          in: path
          required: true
          description: The transaction identifier
          schema:
            type: integer
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountTransactionUpdateRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/AccountTransactionResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                    const: RESOURCE_NOT_FOUND
                  message:
                    type: string
                  errors:
                    type: 'null'
                  data:
                    type: 'null'
                required:
                  - success
                  - error_code
                  - message
                  - errors
                  - data
        '409':
          $ref: '#/components/responses/CustomerErasedException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    AccountTransactionUpdateRequest:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/AccountTransactionType'
          description: The type.
        amount:
          type: number
          description: >-
            New amount of the transaction, placed on the side given by
            `direction` (or the current side). Cannot be sent with
            `debit`/`credit`.
          minimum: 0.01
        direction:
          type: string
          description: >-
            The side the amount is recorded on: debit (money in) or credit
            (money out).
          enum:
            - debit
            - credit
        debit:
          type: number
          description: Debit amount.
          minimum: 0
        credit:
          type: number
          description: Credit amount.
          minimum: 0
        currency_id:
          type: integer
          description: The currency ID.
        exchange_rate:
          type: number
          description: Currency exchange rate.
          minimum: 0
        transaction_date:
          type: string
          format: date-time
          description: Transaction date (YYYY-MM-DD).
        payment_method:
          anyOf:
            - $ref: '#/components/schemas/PaymentMethod'
              description: The payment method.
            - type: 'null'
        description:
          type:
            - string
            - 'null'
          description: The description.
          maxLength: 65535
        invoice_number:
          type:
            - string
            - 'null'
          description: Invoice number.
          maxLength: 255
      title: AccountTransactionUpdateRequest
    AccountTransactionResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        tenant_id:
          type:
            - integer
            - 'null'
        batch_uuid:
          type:
            - string
            - 'null'
        account_id:
          type: integer
        account:
          $ref: '#/components/schemas/RelatedAccountResource'
        currency_id:
          type:
            - integer
            - 'null'
        currency:
          $ref: '#/components/schemas/RelatedCurrencyResource'
        exchange_rate:
          type: number
        debit:
          type: string
        credit:
          type: string
        amount:
          type: string
        transaction_date:
          type: string
          format: date-time
        type:
          type: string
        payment_method:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
        invoice_number:
          type:
            - string
            - 'null'
        customer:
          anyOf:
            - $ref: '#/components/schemas/RelatedCustomerResource'
              description: >-
                The patient the transaction was recorded against, or `null` for
                a movement without a patient. Only date, payment method, invoice
                number and description of such a transaction can be updated.
            - type: 'null'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - record_state
        - tenant_id
        - batch_uuid
        - account_id
        - currency_id
        - exchange_rate
        - debit
        - credit
        - amount
        - transaction_date
        - type
        - payment_method
        - description
        - invoice_number
        - created_at
        - updated_at
      title: AccountTransactionResource
    AccountTransactionType:
      type: string
      enum:
        - collection
        - payment
        - transfer
        - bank_commission
        - opening_balance
      title: AccountTransactionType
    PaymentMethod:
      type: string
      enum:
        - bank_account
        - cash
        - transfer_cash
        - other
        - clinic_credit_card
        - credit_card
        - private_insurance
        - sgk
      title: PaymentMethod
    RecordStateResource:
      type: object
      properties:
        is_read_only:
          type: boolean
          description: >-
            True when every write on this record is refused; false does not
            imply the caller may write.
        reason_code:
          type:
            - string
            - 'null'
          description: >-
            Why the record is read-only (`CUSTOMER_ERASED`, or
            `LEAD_NOT_ASSIGNED` for a salesperson on another rep's lead), or
            null when it is not.
      required:
        - is_read_only
        - reason_code
      title: RecordStateResource
    RelatedAccountResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
        - id
        - name
      title: RelatedAccountResource
    RelatedCurrencyResource:
      type: object
      properties:
        id:
          type: integer
        code:
          type:
            - string
            - 'null'
        symbol:
          type:
            - string
            - 'null'
        name:
          type: string
      required:
        - id
        - code
        - symbol
        - name
      title: RelatedCurrencyResource
    RelatedCustomerResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        first_name:
          anyOf:
            - type: string
            - type: 'null'
        last_name:
          anyOf:
            - type: string
            - type: 'null'
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
            - type: 'null'
        is_masked:
          type: boolean
          description: >-
            Whether the identity fields are masked because the viewer may not
            see this lead's patient.
        is_lead_stage:
          type: boolean
          description: >-
            Whether the person is still a lead (link to `/leads/{lead_id}`)
            rather than a patient (link to `/customers/{id}`).
        lead_id:
          type:
            - integer
            - 'null'
          description: >-
            The lead the person came from; kept after conversion, so check
            `is_lead_stage` before linking to it.
      required:
        - id
        - record_state
        - first_name
        - last_name
        - phone_number
        - email
        - is_masked
        - is_lead_stage
        - lead_id
      title: RelatedCustomerResource
  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
    CustomerErasedException:
      description: The patient record has been erased and is read-only
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: Always false for an error.
                examples:
                  - false
              error_code:
                type: string
                description: Machine-readable error code.
                examples:
                  - CUSTOMER_ERASED
              message:
                type: string
                description: Localized error message.
            required:
              - success
              - error_code
              - 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://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

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