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

# Fatura listesi

> Sistem üzerinden kesilen faturaları sayfalı, filtreli ve sıralı listeler. Kalem satırları (lines) bu uçta dönmez; detay ucundadır. Bilinmeyen filter alanı 400 VALIDATION_FAILED döner.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/invoices
openapi: 3.0.3
info:
  title: Sarraf API v1
  version: 1.0.0
  description: >-
    Sarraf sürümlü dış API yüzeyi. Bu sürüm salt okunurdur; e-ticaret siteleri
    ve muhasebe programları için mevcut kayıtların okunmasını sağlar. Kimlik
    doğrulama mevcut dış API ile aynıdır: HTTP Basic,
    base64(apiUserId:secretKey). Tüm yanıtlar sabit zarf formatındadır: başarılı
    yanıtta success/data/meta, hatalı yanıtta
    success/error{code,message,details}/traceId. Her yanıtta x-request-id
    başlığı döner ve traceId ile aynıdır.
servers:
  - url: https://api.sarraf.pro
    description: Canlı ortam
security:
  - BasicAuth: []
tags:
  - name: Customers
    description: Cari hesaplar — listeleme, detay ve müşteri tanı formatında oluşturma
    x-group: Müşteriler
  - name: Bank accounts
    description: Banka hesapları, bakiyeler ve sorgu tetikleme
    x-group: Banka
  - name: Bank transactions
    description: Gelen/giden banka hareketleri — detayda gömülü MASAK özeti
    x-group: Banka
  - name: Invoices
    description: Sistem üzerinden kesilen faturalar ve kalem şablonları
    x-group: Faturalar
  - name: Expenses
    description: Gider pusulası kayıtları
    x-group: Giderler
  - name: Compliance
    description: >-
      Müşteri tanı formları, kimlik belgeleri, yaptırım sorguları, sicil,
      denetim ve IDV kayıtları
    x-group: Uyum (Compliance)
paths:
  /v1/invoices:
    get:
      tags:
        - Invoices
      summary: Fatura listesi
      description: >-
        Sistem üzerinden kesilen faturaları sayfalı, filtreli ve sıralı
        listeler. Kalem satırları (lines) bu uçta dönmez; detay ucundadır.
        Bilinmeyen filter alanı 400 VALIDATION_FAILED döner.
      operationId: listInvoices
      parameters:
        - name: page
          in: query
          required: false
          description: Sayfa numarası (en az 1).
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: pageSize
          in: query
          required: false
          description: Sayfa başına kayıt (1-100).
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          required: false
          description: >-
            Sıralama: alan:asc|desc. İzinli alanlar: transactionDate, createdAt,
            updatedAt, payableTotal. Varsayılan transactionDate:asc.
          schema:
            type: string
            pattern: ^(transactionDate|createdAt|updatedAt|payableTotal)(:(asc|desc))?$
        - name: q
          in: query
          required: false
          description: >-
            Serbest metin arama. Numerik değer idNo tam eşleşmesi, metin değer
            müşteri ünvanı (customer.name) içinde arama yapar.
          schema:
            type: string
        - name: filter[idNo]
          in: query
          required: false
          description: Müşteri TCKN/VKN tam eşleşme.
          schema:
            type: string
        - name: filter[invoiceNumber]
          in: query
          required: false
          description: Fatura numarası tam eşleşme.
          schema:
            type: string
        - name: filter[type]
          in: query
          required: false
          description: Fatura türü (invoiceInfo.type).
          schema:
            type: string
        - name: filter[integrator]
          in: query
          required: false
          description: Entegratör (invoiceInfo.integrator).
          schema:
            type: string
        - name: filter[module]
          in: query
          required: false
          description: Faturanın üretildiği modül.
          schema:
            type: string
        - name: filter[startDate]
          in: query
          required: false
          description: ISO-8601 tarih; transactionDate >= startDate.
          schema:
            type: string
            format: date-time
        - name: filter[endDate]
          in: query
          required: false
          description: ISO-8601 tarih; transactionDate <= endDate.
          schema:
            type: string
            format: date-time
        - name: filter[updatedSince]
          in: query
          required: false
          description: >-
            ISO-8601 tarih; yalnız bu tarihte veya sonra güncellenen kayıtlar
            döner (updatedAt >=).
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Başarılı liste yanıtı.
          headers:
            x-request-id:
              description: İstek kimliği; yanıt gövdesindeki meta.requestId ile aynıdır.
              schema:
                type: string
                format: uuid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceListResponse'
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    InvoiceListResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceListItem'
        meta:
          $ref: '#/components/schemas/MetaList'
      required:
        - success
        - data
        - meta
    InvoiceListItem:
      type: object
      properties:
        id:
          type: string
          description: Kayıt kimliği (ObjectId).
        transactionDate:
          type: string
          format: date-time
          description: Fatura / resmileştirme tarihi.
        invoiceNumber:
          type: string
          nullable: true
        invoiceType:
          type: string
          nullable: true
        integrator:
          type: string
          nullable: true
        invoiceStatus:
          type: boolean
          nullable: true
        linesTotal:
          type: number
        kdvTotal:
          type: number
        allowanceTotal:
          type: number
        payableTotal:
          type: number
        customer:
          $ref: '#/components/schemas/InvoiceCustomerSummary'
        idNo:
          type: string
          nullable: true
          description: Müşteri TCKN/VKN.
        module:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    MetaList:
      allOf:
        - $ref: '#/components/schemas/MetaBase'
        - type: object
          properties:
            page:
              type: integer
            limit:
              type: integer
            total:
              type: integer
            pages:
              type: integer
          required:
            - page
            - limit
            - total
            - pages
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorBody'
        traceId:
          type: string
          format: uuid
          description: x-request-id başlığı ile aynı değer.
      required:
        - success
        - error
        - traceId
    InvoiceCustomerSummary:
      type: object
      properties:
        taxNumber:
          type: string
          nullable: true
          description: Müşteri vergi/kimlik numarası.
        name:
          type: string
          nullable: true
          description: Müşteri adı / ünvanı.
    MetaBase:
      type: object
      properties:
        requestId:
          type: string
          format: uuid
        timestamp:
          type: string
          format: date-time
      required:
        - requestId
        - timestamp
    ErrorBody:
      type: object
      properties:
        code:
          type: string
          enum:
            - VALIDATION_FAILED
            - AUTH_INVALID_CREDENTIALS
            - AUTH_FORBIDDEN
            - RESOURCE_NOT_FOUND
            - CONFLICT
            - UPSTREAM_ERROR
            - INTERNAL_ERROR
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
      required:
        - code
        - message
        - details
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
        rule:
          type: string
  responses:
    ValidationFailed:
      description: Doğrulama hatası (geçersiz parametre).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Kimlik doğrulama başarısız.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Beklenmeyen sunucu hatası.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: >-
        Kullanıcı adı apiUserId, parola secretKey. Authorization: Basic
        base64(apiUserId:secretKey)

````