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

# Idempotent manuel banka senkronizasyonu çalıştır

> bank:operate scope'u gerektirir; firma, banka ve providerStamp alanlarıyla idempotent kayıt sağlar. Repeatable IBAN hedefleri sırayla sorgulanır, sonuçlar bellekte birleştirilir ve hedeflerden biri başarısız olursa kısmi hareket yazılmaz. Hedef sorgusu hataları 502 BANK_ACCOUNT_TARGET_QUERY_FAILED, farklı alt hesaplara bağlanan aynı stamp ise 502 PROVIDER_STAMP_COLLISION döndürür.



## OpenAPI

````yaml /openapi/openapi.yaml post /banks/accounts/{id}/sync
openapi: 3.1.0
info:
  title: Tahsil API
  version: 1.0.0
  description: >-
    Tahsil banka bağlantıları, provider senkronizasyonu, değiştirilemez
    hareketler, zamanlamalar ve hareket otomasyonu için tenant-scoped public API
    sözleşmesi.
servers:
  - url: https://api.tahsil.dev
    description: Production
security:
  - apiKeyAuth: []
    apiSecretAuth: []
tags:
  - name: Sistem - Sağlık
    description: Servis canlılığı ve bağımlılık hazır olma kontrolleri.
  - name: Banka - Bağlantılar
    description: Banka bağlantısı, credential, setup, sync, health ve kullanım işlemleri.
  - name: Banka - Hareketler
    description: >-
      Provider senkronizasyonuyla oluşan değiştirilemez banka hareketleri ve CSV
      dışa aktarımı.
  - name: Banka - Otomasyon
    description: Hareket atamaları, kurallar, preview ve backfill çalışmaları.
  - name: Banka - Zamanlamalar
    description: Banka sorgularının zamanlama ve çalışma durumu yönetimi.
  - name: Banka - Analitik
    description: Tenant kapsamlı dashboard sorgu kataloğu ve analitik sonuçları.
  - name: Denetim - Connector Logları
    description: Maskelenmiş banka connector istek ve yanıt kayıtları.
paths:
  /banks/accounts/{id}/sync:
    parameters:
      - $ref: '#/components/parameters/Id'
      - name: x-company-id
        in: header
        required: true
        schema:
          type: string
        description: Provider bağlantısının hedef firma kimliği.
    post:
      tags:
        - Banka - Bağlantılar
      summary: Idempotent manuel banka senkronizasyonu çalıştır
      description: >-
        bank:operate scope'u gerektirir; firma, banka ve providerStamp
        alanlarıyla idempotent kayıt sağlar. Repeatable IBAN hedefleri sırayla
        sorgulanır, sonuçlar bellekte birleştirilir ve hedeflerden biri
        başarısız olursa kısmi hareket yazılmaz. Hedef sorgusu hataları 502
        BANK_ACCOUNT_TARGET_QUERY_FAILED, farklı alt hesaplara bağlanan aynı
        stamp ise 502 PROVIDER_STAMP_COLLISION döndürür.
      operationId: postBanksAccountsByIdSync
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BankSyncRequest'
      responses:
        '200':
          $ref: '#/components/responses/BankSyncResponse'
        '402':
          $ref: '#/components/responses/ErrorResponse'
        '409':
          $ref: '#/components/responses/ErrorResponse'
        '422':
          $ref: '#/components/responses/ErrorResponse'
        '502':
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
  schemas:
    BankSyncRequest:
      type: object
      additionalProperties: false
      example:
        startDate: '2026-07-01T00:00:00.000Z'
        endDate: '2026-07-15T00:00:00.000Z'
      properties:
        startDate:
          type: string
          format: date
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: Provider sorgusunun opsiyonel ve dahil başlangıç tarihi.
        endDate:
          type: string
          format: date
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: >-
            Provider sorgusunun opsiyonel ve dahil bitiş tarihi; startDate
            değerinden önce olamaz.
    BankSyncResult:
      type: object
      required:
        - accountId
        - bankCode
        - fetched
        - inserted
        - duplicates
        - accountCount
        - accountUpdated
        - fetchedAt
      properties:
        accountId:
          type: string
          description: MongoDB kaynak kimliği.
        bankCode:
          type: string
        fetched:
          type: integer
          minimum: 0
        inserted:
          type: integer
          minimum: 0
        duplicates:
          type: integer
          minimum: 0
        accountCount:
          type: integer
          minimum: 0
        accountUpdated:
          type: boolean
        fetchedAt:
          type: string
          format: date-time
      additionalProperties: false
  responses:
    BankSyncResponse:
      description: Idempotent senkronizasyon özeti.
      content:
        application/json:
          schema:
            type: object
            required:
              - status
              - result
            properties:
              status:
                type: boolean
                const: true
              result:
                $ref: '#/components/schemas/BankSyncResult'
            additionalProperties: false
    ErrorResponse:
      description: İstek başarısız oldu.
      content:
        application/json:
          schema:
            type: object
            required:
              - status
            properties:
              status:
                type: boolean
                const: false
              code:
                type: string
                description: >-
                  Kararlı hata kodu; kodlanmış domain ve güvenlik hatalarında
                  döner.
              message:
                type: string
                description: >-
                  İnsan tarafından okunabilir hata açıklaması; mevcutsa
                  entegrasyon kararı için kullanılmamalıdır.
              meta:
                type: object
                additionalProperties: true
              result:
                type: array
                deprecated: true
                description: Legacy Joi doğrulama hatalarında dönen alan listesi.
                items:
                  type: object
                  properties:
                    type:
                      type: string
                    joiType:
                      type: string
                    path:
                      type:
                        - string
                        - number
                    label:
                      type: string
                  additionalProperties: false
              description:
                type: string
            additionalProperties: false
          example:
            status: false
            code: TRANSACTION_AMOUNT_RANGE_INVALID
            message: minAmount, maxAmount değerinden büyük olamaz.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Tenant admin tarafından oluşturulan API anahtarının kimliği.
    apiSecretAuth:
      type: apiKey
      in: header
      name: x-api-secret
      description: >-
        Yalnız oluşturma anında gösterilen API anahtarı secret değeri. x-api-key
        ile aynı istekte gönderilir.

````