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

# Dashboard analitik sorgusunu çalıştır

> Firma header'ı verilmezse API credential'ın bağlı olduğu tek firma kapsamı kullanılır.



## OpenAPI

````yaml /openapi/openapi.yaml post /banks/dashboard/query
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/dashboard/query:
    post:
      tags:
        - Banka - Analitik
      summary: Dashboard analitik sorgusunu çalıştır
      description: >-
        Firma header'ı verilmezse API credential'ın bağlı olduğu tek firma
        kapsamı kullanılır.
      operationId: postBanksDashboardQuery
      parameters:
        - $ref: '#/components/parameters/XCompanyId'
        - $ref: '#/components/parameters/XCompanyIds'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardQueryRequest'
      responses:
        '200':
          $ref: '#/components/responses/DashboardQueryResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '422':
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    XCompanyId:
      name: x-company-id
      in: header
      required: false
      schema:
        type: string
      description: >-
        Hedef firma kimliği. Müşteri banka endpointlerindeki yazma işlemleri
        için zorunludur.
    XCompanyIds:
      name: x-company-ids
      in: header
      required: false
      schema:
        type: string
      description: >-
        API credential tek firma kapsamlıdır; gönderilirse credential firmasıyla
        eşleşen tek kimlik içermelidir.
  schemas:
    DashboardQueryRequest:
      type: object
      required:
        - range
        - metrics
      example:
        range:
          preset: last_30d
          timezone: Europe/Istanbul
        groupBy:
          - currency
        metrics:
          - count
          - sum(amount)
        limit: 20
      properties:
        range:
          $ref: '#/components/schemas/DashboardRange'
        filters:
          $ref: '#/components/schemas/DashboardFilters'
        groupBy:
          type: array
          items:
            type: string
            enum:
              - bankCode
              - subAccountKey
              - currency
              - incoming
              - transactionDate:day
              - transactionDate:week
              - transactionDate:month
              - descriptionBucket
        metrics:
          type: array
          items:
            type: string
            enum:
              - count
              - sum(amount)
              - sum(balance)
              - avg(amount)
              - max(amount)
              - min(amount)
        sort:
          type: array
          items:
            $ref: '#/components/schemas/DashboardSort'
        limit:
          type: integer
          minimum: 1
          maximum: 500
    DashboardRange:
      type: object
      properties:
        preset:
          type: string
          enum:
            - last_7d
            - last_30d
            - today
            - custom
        from:
          type:
            - string
            - 'null'
          format: date-time
        to:
          type:
            - string
            - 'null'
          format: date-time
        timezone:
          type:
            - string
            - 'null'
    DashboardFilters:
      type: object
      properties:
        bankCode:
          type: array
          items:
            type: string
        currency:
          type: array
          items:
            type: string
        incoming:
          type: boolean
        accountId:
          type: array
          items:
            type: string
        subAccountKey:
          type: array
          items:
            type: string
        amountMin:
          type: number
        amountMax:
          type: number
    DashboardSort:
      type: object
      required:
        - field
        - direction
      properties:
        field:
          type: string
        direction:
          type: string
          enum:
            - asc
            - desc
    DashboardQueryResult:
      type: object
      required:
        - rows
        - totals
        - meta
      properties:
        rows:
          type: array
          items:
            type: object
            additionalProperties: true
        totals:
          type: object
          additionalProperties:
            type: number
        meta:
          type: object
          required:
            - queryHash
            - cacheHit
            - executionMs
            - timezone
            - range
          properties:
            queryHash:
              type: string
            cacheHit:
              type: boolean
            executionMs:
              type: integer
              minimum: 0
            timezone:
              type: string
            range:
              type: object
              properties:
                from:
                  type: string
                  format: date-time
                to:
                  type: string
                  format: date-time
          additionalProperties: false
      additionalProperties: false
  responses:
    DashboardQueryResponse:
      description: Dashboard sorgu sonucu.
      content:
        application/json:
          schema:
            type: object
            required:
              - status
              - result
            properties:
              status:
                type: boolean
                const: true
              result:
                $ref: '#/components/schemas/DashboardQueryResult'
            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.

````