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

# Alış-satış belgesini güncelle

> Ödeme bağı olmayan belgenin tam gövdesini değiştirir ve bu belgeye ait stok etkisini yeniden hesaplar.

> [!WARNING]
>
> Bu çağrı kayıt değiştirir. `Idempotency-Key` zorunludur. Güncel `version` değerini `If-Match` başlığında çift tırnakla
> gönderin. Zaman aşımından sonra yeni anahtarla tekrar başlatmadan işlem durumunu okuyun.

## Ne yapar?

Ödeme bağı olmayan belgenin tam gövdesini değiştirir ve bu belgeye ait stok etkisini yeniden hesaplar. Eksik isteğe bağlı alanlar varsayılanlarına döner. Ödeme varsa önce bu ödemenin mahsuplaşmasını kaldırın veya ödemeyi iptal edin.

## Ön koşullar ve izin

Gereken izin: **`muhasip:transactions:write`**. Bu kaynak için açık izin tanımlanmalıdır; genel erişim veya yönetici yetkisi bu iznin yerine geçmez. İlişkili bütün kimlikler aynı firma kapsamında olmalıdır.

Yeni mali kayıt için kullanılan cari, kasa veya hesap aktif olmalıdır. Ürün/depo kimlikleri verilirse geçerli, aynı firmaya ait ve yeni işlem için aktif olmalıdır.

[Kimlik ve izinler](https://docs.muhasip.pro/baslangic/kimlik-ve-izinler.md) · [Muhasebe veri kuralları](https://docs.muhasip.pro/rehberler/muhasebe-veri-kurallari.md)

## İstek örnekleri

Kimlikleri kendi kayıtlarınızla değiştirin. Yazmada iş niyetine özel anahtarı istekten önce saklayın; örnek anahtarını farklı işler için yeniden kullanmayın. Alan ve cevap tanımları bu sayfanın API referansında yer alır.

```bash cURL theme={null}
curl --request PUT 'https://api.muhasip.pro/accounting/invoices/507f1f77bcf86cd799439014' \
  --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: ORNEK-ACCOUNTINGTRANSACTIONSUPDATE-001' \
  --header 'If-Match: "0"' \
  --data '{"contactId":"507f1f77bcf86cd799439011","direction":"sale","issueDate":"2026-10-19","currencyCode":"TRY","exchangeRate":"1","receiptNumber":"SATIS-ORNEK-001","lines":[{"name":"Danışmanlık hizmeti","quantity":"2","unitCode":"C62","unitPrice":"100.00","vatRate":"20"}],"description":"Açıklama düzeltildi"}'
```

```php PHP theme={null}
<?php
$apiUserId = getenv("MUHASIP_API_USER_ID");
$secret = getenv("MUHASIP_API_SECRET");
if (!$apiUserId || !$secret) {
    throw new RuntimeException("API kimlik bilgileri eksik.");
}
$body = json_decode("{\"contactId\": \"507f1f77bcf86cd799439011\", \"direction\": \"sale\", \"issueDate\": \"2026-10-19\", \"currencyCode\": \"TRY\", \"exchangeRate\": \"1\", \"receiptNumber\": \"SATIS-ORNEK-001\", \"lines\": [{\"name\": \"Danışmanlık hizmeti\", \"quantity\": \"2\", \"unitCode\": \"C62\", \"unitPrice\": \"100.00\", \"vatRate\": \"20\"}], \"description\": \"Açıklama düzeltildi\"}", true, 512, JSON_THROW_ON_ERROR);
$curl = curl_init("https://api.muhasip.pro/accounting/invoices/507f1f77bcf86cd799439014");
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD => $apiUserId . ":" . $secret,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => [
        "Accept: application/json",
        "Content-Type: application/json",
        "Idempotency-Key: ORNEK-ACCOUNTINGTRANSACTIONSUPDATE-001",
        "If-Match: \"0\""
    ],
    CURLOPT_POSTFIELDS => json_encode($body, JSON_THROW_ON_ERROR)
]);
$response = curl_exec($curl);
$httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($response === false) {
    curl_close($curl);
    throw new RuntimeException("Bağlantı sonucu belirsiz; yazma işlemini yeniden göndermeden durumunu kontrol edin.");
}
curl_close($curl);
$result = json_decode($response, true, 512, JSON_THROW_ON_ERROR);
echo json_encode(["httpStatus" => $httpStatus, "response" => $result], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);
```

```javascript Node.js theme={null}
async function main() {
  const apiUserId = process.env.MUHASIP_API_USER_ID
  const secret = process.env.MUHASIP_API_SECRET
  if (!apiUserId || !secret) throw new Error("API kimlik bilgileri eksik.")
  const authorization = Buffer.from(`${apiUserId}:${secret}`, "utf8").toString("base64")
  const response = await fetch("https://api.muhasip.pro/accounting/invoices/507f1f77bcf86cd799439014", {
    method: "PUT",
    headers: {
      Authorization: `Basic ${authorization}`,
      Accept: "application/json",
      "Content-Type": "application/json",
      "Idempotency-Key": "ORNEK-ACCOUNTINGTRANSACTIONSUPDATE-001",
      "If-Match": '"0"'
    },
    body: JSON.stringify({
      contactId: "507f1f77bcf86cd799439011",
      direction: "sale",
      issueDate: "2026-10-19",
      currencyCode: "TRY",
      exchangeRate: "1",
      receiptNumber: "SATIS-ORNEK-001",
      lines: [
        {
          name: "Danışmanlık hizmeti",
          quantity: "2",
          unitCode: "C62",
          unitPrice: "100.00",
          vatRate: "20"
        }
      ],
      description: "Açıklama düzeltildi"
    }),
    signal: AbortSignal.timeout(30000)
  })
  const result = await response.json()
  console.log({ httpStatus: response.status, response: result })
}
main().catch(() => {
  console.error("İstek tamamlanamadı; yazma sonucunu kontrol etmeden yeniden göndermeyin.")
  process.exitCode = 1
})
```

## Cevabı değerlendirin

Aşağıdaki cevap temsilîdir.

```json theme={null}
{
  "status": true,
  "result": {
    "id": "507f1f77bcf86cd799439014",
    "version": 1,
    "contactId": "507f1f77bcf86cd799439011",
    "direction": "sale",
    "issueDate": "2026-10-19",
    "dueDate": "2026-10-19",
    "currencyCode": "TRY",
    "exchangeRate": 1,
    "description": "Açıklama düzeltildi",
    "receiptNumber": "SATIS-ORNEK-001",
    "notes": [],
    "lines": [
      {
        "name": "Danışmanlık hizmeti",
        "description": "",
        "quantity": 2,
        "unitCode": "C62",
        "unitPrice": 100,
        "grossAmount": 200,
        "discountAmount": 0,
        "vatRate": 20,
        "vatAmount": 40,
        "withholdingPercent": 0,
        "withheldVatAmount": 0,
        "lineTotal": 240
      }
    ],
    "totals": {
      "grossAmount": 200,
      "lineDiscountAmount": 0,
      "documentDiscountAmount": 0,
      "discountAmount": 0,
      "taxes": [
        {
          "code": "0015",
          "rate": 20,
          "amount": 40
        }
      ],
      "withheldVatAmount": 0,
      "payableAmount": 240
    },
    "baseCurrencyCode": "TRY",
    "payableBaseAmount": 240,
    "paidBaseAmount": 0,
    "remainingBaseAmount": 240,
    "overpaidBaseAmount": 0,
    "isClosed": false,
    "tracksStock": false,
    "createdAt": "2026-10-19T09:00:00.000Z"
  },
  "operation": {
    "operationId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "type": "transactions.update",
    "state": "succeeded",
    "reviewRequired": false,
    "retryable": false,
    "result": {
      "resultId": "507f1f77bcf86cd799439014"
    },
    "statusUrl": "/apps/operations/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "createdAt": "2026-10-19T09:00:00.000Z",
    "updatedAt": "2026-10-19T09:00:01.000Z"
  }
}
```

İlk başarılı çağrı `result` ile kayıt sonucunu ve `operation` ile makbuzu döndürür. Aynı iş anahtarıyla tamamlanmış tekrar **200** ve `replayed:true` döndürür; ilk ayrıntı gövdesi tekrarlanmaz. Sonuç kimliğiyle ilgili okuma ucunu kullanın. `reviewRequired:true` sonucunu başarılı mali işlem kabul etmeyin.

## Hata durumunda

| HTTP / kod | İzlenecek adım |
| - | - |
| `400 INVALID_REQUEST` | Alanları, tarihi, ondalık hassasiyeti ve desteklenmeyen alanları kontrol edin. |
| `401` / `403` | Kimlik, IP ve açık modül iznini doğrulayın. |
| `404 RESOURCE_NOT_FOUND` | Kaynağın ve bağlı kimliklerin doğru olduğunu, bu kaynak türünde kullanılabildiğini kontrol edin. |
| `409 RESOURCE_ARCHIVED` | Yeni işlemden önce kartı arşivden çıkarın. |
| `409 INVOICE_HAS_PAYMENTS` | Önce ilgili ödemenin mahsuplaşmasını kaldırın veya ödemeyi iptal edin. |
| `428 RECORD_VERSION_REQUIRED` / `409 RECORD_CHANGED` | Güncel kaydı okuyun. `If-Match: "0"` biçimini ve sürümünü kontrol edin. |
| `409 IDEMPOTENCY_PAYLOAD_CONFLICT` | Aynı iş anahtarıyla farklı gövde, kimlik veya If-Match göndermeyin. Önce mevcut işlemi inceleyin. |
| `409 OPERATION_TARGET_LOCKED` / `OPERATION_IN_PROGRESS` | Dönen işlem kimliğini takip edin; beklemek veya anahtarı değiştirmek işlem izni vermez. |
| `502` / `503` | Otomatik tekrar yapmayın. İşlem durumunu ve kayıtları inceleyin. |

[Hata yönetimi](https://docs.muhasip.pro/rehberler/hata-yonetimi.md) · [İşlem takibi](https://docs.muhasip.pro/rehberler/islem-takibi.md)

## Sonraki adım

[Belgeden tahsilata ilerleyin](https://docs.muhasip.pro/rehberler/alis-satis-entegrasyonu.md). Dönen kimlikleri ve `version` değerini saklayın; mali yazma sonrasında ilgili belge ve cari bakiyesini okuyun.


## OpenAPI

````yaml openapi.json PUT /accounting/invoices/{id}
openapi: 3.0.3
info:
  title: Muhasip API
  version: 2026-10-25.1
  description: >-
    Fatura, banka, POS ve tahsilat, GİB e-Arşiv, pazaryeri, online işlemler,
    görevler, ajanda ve takvim entegrasyonları. İşlem alanları, izinler, istek
    ve cevap örnekleri ile hata yönetimi.
servers:
  - url: https://api.muhasip.pro
    description: Muhasip API
security:
  - BasicAuth: []
tags:
  - name: Uygulamalar
  - name: Görev yönetimi
  - name: Ajanda ve takvim
  - name: Fatura
    description: Fatura bağlantısı, belge işlemleri ve muhasebeye aktarım.
  - name: Banka
    description: >-
      Banka hesapları, hareketler, mahsup ve mevcut çalışma alanı alt
      kaynakları.
  - name: POS ve tahsilat
    description: POS hesapları, komisyonlar ve tahsilat bağlantıları.
  - name: GİB e-Arşiv
    description: GİB hesabı, sorgu, taslak ve SMS imzalama.
  - name: Pazaryeri
    description: Trendyol bağlantısı ve sipariş aktarımı.
  - name: Online işlemler
    description: Online işlem ekranı yapılandırması.
  - name: İşlem takibi
    description: Mali işlem durumu ve tekrar çağrı makbuzları.
  - name: Cari hesaplar
    description: Cari hesaplar işlemleri.
  - name: Kasa ve transferler
    description: Kasa ve transferler işlemleri.
  - name: Alış-satış (e-belgesiz)
    description: Alış-satış (e-belgesiz) işlemleri.
  - name: Ödemeler ve mahsuplaşma
    description: Ödemeler ve mahsuplaşma işlemleri.
  - name: Muhasebe seçenekleri
    description: Muhasebe seçenekleri işlemleri.
  - name: E-Pos
    description: >-
      Firmanın kendi banka/ödeme kuruluşu sanal POS hesapları, tarifeler, ödeme
      talepleri ve tam iptal/iade.
paths:
  /accounting/invoices/{id}:
    put:
      tags:
        - Alış-satış (e-belgesiz)
      summary: Alış-satış belgesini güncelle
      description: >-
        Ödeme bağı olmayan belgenin tam gövdesini değiştirir ve bu belgeye ait
        stok etkisini yeniden hesaplar. Eksik isteğe bağlı alanlar
        varsayılanlarına döner. Ödeme varsa önce bu ödemenin mahsuplaşmasını
        kaldırın veya ödemeyi iptal edin. Idempotency-Key zorunludur.
        Tamamlanmış tekrar, ilk result ayrıntısını değil operation ve güvenli
        sonuç kimliklerini döndürür. Güncelleme/iptal öncesi güncel version için
        If-Match kullanın.
      operationId: accountingTransactionsUpdate
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            description: 24 karakterli kayıt kimliği.
            pattern: ^[a-f0-9A-F]{24}$
          description: Kaynak kimliği. Transferde kaynak hareket/transfer kimliği.
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 128
            pattern: ^[!-~]+$
          description: >-
            Her yeni iş niyeti için kalıcı, farklı anahtar. Aynı
            anahtar+işlem+firma ve farklı içerik 409 üretir; tamamlanmış tekrar
            200 replay makbuzu döner.
        - name: If-Match
          in: header
          required: true
          schema:
            type: string
            pattern: ^"[0-9]{1,10}"$
          description: >-
            Güncel version çift tırnakla gönderilir; örneğin "0". Açılış
            iptalinde açılış hareketinin, transfer iptalinde source hareketin
            sürümüdür.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountingInvoiceInput'
            example:
              contactId: 507f1f77bcf86cd799439011
              direction: sale
              issueDate: '2026-10-19'
              currencyCode: TRY
              exchangeRate: '1'
              receiptNumber: SATIS-ORNEK-001
              lines:
                - name: Danışmanlık hizmeti
                  quantity: '2'
                  unitCode: C62
                  unitPrice: '100.00'
                  vatRate: '20'
              description: Açıklama düzeltildi
      responses:
        '200':
          description: İşlem tamamlandı. Yazma cevabındaki operation makbuzunu saklayın.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      status:
                        type: boolean
                        enum:
                          - true
                      result:
                        $ref: '#/components/schemas/AccountingInvoice'
                      operation:
                        $ref: '#/components/schemas/ApiOperation'
                    required:
                      - status
                      - result
                      - operation
                    additionalProperties: false
                  - $ref: '#/components/schemas/ApiOperationReplay'
              examples:
                completed:
                  value:
                    status: true
                    result:
                      id: 507f1f77bcf86cd799439014
                      version: 1
                      contactId: 507f1f77bcf86cd799439011
                      direction: sale
                      issueDate: '2026-10-19'
                      dueDate: '2026-10-19'
                      currencyCode: TRY
                      exchangeRate: 1
                      description: Açıklama düzeltildi
                      receiptNumber: SATIS-ORNEK-001
                      notes: []
                      lines:
                        - name: Danışmanlık hizmeti
                          description: ''
                          quantity: 2
                          unitCode: C62
                          unitPrice: 100
                          grossAmount: 200
                          discountAmount: 0
                          vatRate: 20
                          vatAmount: 40
                          withholdingPercent: 0
                          withheldVatAmount: 0
                          lineTotal: 240
                      totals:
                        grossAmount: 200
                        lineDiscountAmount: 0
                        documentDiscountAmount: 0
                        discountAmount: 0
                        taxes:
                          - code: '0015'
                            rate: 20
                            amount: 40
                        withheldVatAmount: 0
                        payableAmount: 240
                      baseCurrencyCode: TRY
                      payableBaseAmount: 240
                      paidBaseAmount: 0
                      remainingBaseAmount: 240
                      overpaidBaseAmount: 0
                      isClosed: false
                      tracksStock: false
                      createdAt: '2026-10-19T09:00:00.000Z'
                    operation:
                      operationId: >-
                        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      type: transactions.update
                      state: succeeded
                      reviewRequired: false
                      retryable: false
                      result:
                        resultId: 507f1f77bcf86cd799439014
                      statusUrl: >-
                        /apps/operations/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      createdAt: '2026-10-19T09:00:00.000Z'
                      updatedAt: '2026-10-19T09:00:01.000Z'
                replayed:
                  value:
                    status: true
                    replayed: true
                    operation:
                      operationId: >-
                        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      type: transactions.update
                      state: succeeded
                      reviewRequired: false
                      retryable: false
                      result:
                        resultId: 507f1f77bcf86cd799439014
                      statusUrl: >-
                        /apps/operations/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      createdAt: '2026-10-19T09:00:00.000Z'
                      updatedAt: '2026-10-19T09:00:01.000Z'
                    operations:
                      - operationId: >-
                          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                        type: transactions.update
                        state: succeeded
                        reviewRequired: false
                        retryable: false
                        result:
                          resultId: 507f1f77bcf86cd799439014
                        statusUrl: >-
                          /apps/operations/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                        createdAt: '2026-10-19T09:00:00.000Z'
                        updatedAt: '2026-10-19T09:00:01.000Z'
                    resultId: 507f1f77bcf86cd799439014
        '400':
          description: Alan, tarih, hassasiyet, gövde veya başlık geçersiz.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: INVALID_REQUEST
                message: Alan, tarih, hassasiyet, gövde veya başlık geçersiz.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            İlişki, bakiye, kur, sürüm veya işlem kilidi çakışması. İlgili kaydı
            ve işlem durumunu okuyun.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: RECORD_CHANGED
                message: >-
                  İlişki, bakiye, kur, sürüm veya işlem kilidi çakışması. İlgili
                  kaydı ve işlem durumunu okuyun.
        '428':
          description: >-
            Güncel version değerini If-Match başlığında çift tırnak içinde
            gönderin.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: RECORD_VERSION_REQUIRED
                message: >-
                  Güncel version değerini If-Match başlığında çift tırnak içinde
                  gönderin.
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          description: >-
            Mali sonuç kesinleştirilemedi. İşlemi tekrar göndermeden operation
            durumunu ve ilgili kayıtları inceleyin.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: UPSTREAM_RESULT_UNCERTAIN
                message: >-
                  Mali sonuç kesinleştirilemedi. İşlemi tekrar göndermeden
                  operation durumunu ve ilgili kayıtları inceleyin.
        '503':
          description: >-
            İşlem makbuzu oluşturulamadı veya kesinleştirilemedi. Yeniden
            göndermeden durumunu okuyun.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: OPERATION_RECORD_UNAVAILABLE
                message: >-
                  İşlem makbuzu oluşturulamadı veya kesinleştirilemedi. Yeniden
                  göndermeden durumunu okuyun.
components:
  schemas:
    AccountingInvoiceInput:
      type: object
      properties:
        contactId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        direction:
          type: string
          enum:
            - sale
            - purchase
        issueDate:
          type: string
          description: YYYY-MM-DD; 1900-01-01–2199-12-31. Saat gönderilmez.
          format: date
        dueDate:
          type: string
          description: Varsayılan issueDate; belge tarihinden önce olamaz.
          format: date
        currencyCode:
          $ref: '#/components/schemas/AccountingCurrency'
        exchangeRate:
          $ref: '#/components/schemas/AccountingRate'
        description:
          type: string
          maxLength: 2000
        receiptNumber:
          type: string
          description: İsteğe bağlı belge referansı; mükerrer koruma anahtarı değildir.
          maxLength: 100
        notes:
          type: array
          items:
            type: string
            maxLength: 1000
          maxItems: 20
        discountAmount:
          allOf:
            - $ref: '#/components/schemas/AccountingMoney'
          description: >-
            Satır indirimlerinden sonra, KDV öncesi dağıtılacak belge indirimi;
            varsayılan 0.
        lines:
          type: array
          items:
            $ref: '#/components/schemas/AccountingInvoiceLineInput'
          minItems: 1
          maxItems: 100
      required:
        - contactId
        - direction
        - issueDate
        - lines
      additionalProperties: false
      description: >-
        Tam belge gövdesidir. TRY ve exchangeRate=1 varsayılandır; yabancı para
        biriminde kur zorunludur. Hesaplanan toplamlar veya sistem alanları
        kabul edilmez.
    AccountingInvoice:
      type: object
      properties:
        id:
          type: string
          description: Hesaplama cevabında null; kayıtta belge kimliği.
          pattern: ^[a-f0-9A-F]{24}$
          nullable: true
        version:
          type: integer
          minimum: 0
          description: If-Match için kullanılan kayıt sürümü.
        contactId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        direction:
          type: string
          enum:
            - sale
            - purchase
        issueDate:
          type: string
          description: YYYY-MM-DD; 1900-01-01–2199-12-31. Saat gönderilmez.
          format: date
        dueDate:
          type: string
          description: YYYY-MM-DD; 1900-01-01–2199-12-31. Saat gönderilmez.
          format: date
        currencyCode:
          $ref: '#/components/schemas/AccountingCurrency'
        exchangeRate:
          type: number
        description:
          type: string
        receiptNumber:
          type: string
        notes:
          type: array
          items:
            type: string
        lines:
          type: array
          items:
            $ref: '#/components/schemas/AccountingInvoiceLine'
        totals:
          $ref: '#/components/schemas/AccountingInvoiceTotals'
        baseCurrencyCode:
          type: string
          enum:
            - TRY
        payableBaseAmount:
          type: number
        paidBaseAmount:
          type: number
        remainingBaseAmount:
          type: number
        overpaidBaseAmount:
          type: number
        isClosed:
          type: boolean
        tracksStock:
          type: boolean
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - version
        - contactId
        - direction
        - issueDate
        - dueDate
        - currencyCode
        - exchangeRate
        - description
        - receiptNumber
        - notes
        - lines
        - totals
        - baseCurrencyCode
        - payableBaseAmount
        - paidBaseAmount
        - remainingBaseAmount
        - overpaidBaseAmount
        - isClosed
        - tracksStock
      additionalProperties: false
    ApiOperation:
      type: object
      properties:
        operationId:
          type: string
          pattern: ^[a-f0-9]{64}$
        type:
          type: string
        state:
          type: string
          enum:
            - claimed
            - dispatching
            - provider_accepted
            - succeeded
            - rejected
            - failed_before_dispatch
            - review_required
        reviewRequired:
          type: boolean
        retryable:
          type: boolean
        result:
          $ref: '#/components/schemas/ApiOperationReceipt'
        statusUrl:
          type: string
        createdAt:
          type: string
          format: date-time
          description: ISO 8601 tarih-saat.
        updatedAt:
          type: string
          format: date-time
          description: ISO 8601 tarih-saat.
      required:
        - operationId
        - type
        - state
        - reviewRequired
        - retryable
        - result
        - statusUrl
        - createdAt
        - updatedAt
    ApiOperationReplay:
      type: object
      properties:
        status:
          type: boolean
        replayed:
          type: boolean
          enum:
            - true
        operation:
          $ref: '#/components/schemas/ApiOperation'
        operations:
          type: array
          items:
            $ref: '#/components/schemas/ApiOperation'
        resultId:
          type: string
        transactionId:
          type: string
        uuid:
          type: string
        id:
          type: string
        providerId:
          type: string
        documentId:
          type: string
        paymentId:
          type: string
        orderId:
          type: string
        uuids:
          type: array
          items:
            type: string
        sourcePaymentId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        destinationPaymentId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
      required:
        - status
        - replayed
        - operation
        - operations
      additionalProperties: false
    ApiOperationError:
      type: object
      properties:
        status:
          type: boolean
        code:
          type: string
        message:
          type: string
        retryable:
          type: boolean
        reviewRequired:
          type: boolean
        operation:
          $ref: '#/components/schemas/ApiOperation'
        operationId:
          type: string
      required:
        - status
      additionalProperties: true
    AccountingCurrency:
      type: string
      description: >-
        İşlem para birimi. Uygulama tutar hassasiyeti bütün bu birimlerde 2
        basamaktır.
      enum:
        - TRY
        - USD
        - EUR
        - GBP
        - CHF
        - CAD
        - AUD
        - JPY
        - CNY
        - AED
        - SAR
        - RUB
        - DKK
        - NOK
        - SEK
    AccountingRate:
      description: >-
        1 birim dövizin TRY karşılığı; pozitif, en fazla 6 basamak. TRY için 1;
        diğer para birimlerinde zorunlu.
      oneOf:
        - type: number
          minimum: 0
          maximum: 999999.999999
          multipleOf: 0.000001
          exclusiveMinimum: true
        - type: string
          pattern: ^(?=\d{1,12}(?:\.\d{1,6})?$)(?!0+(?:\.0+)?$)0*\d{1,6}(?:\.\d{1,6})?$
      x-decimal-places: 6
    AccountingMoney:
      description: En fazla 2 ondalık basamak; 0–999999999.99. Sayı veya metin.
      oneOf:
        - type: number
          minimum: 0
          maximum: 999999999.99
          multipleOf: 0.01
        - type: string
          pattern: ^(?=\d{1,12}(?:\.\d{1,2})?$)0*\d{1,9}(?:\.\d{1,2})?$
      x-decimal-places: 2
    AccountingInvoiceLineInput:
      type: object
      properties:
        name:
          type: string
          description: Serbest kalem açıklaması; ürün kendiliğinden oluşturulmaz.
          minLength: 1
          maxLength: 250
        description:
          type: string
          maxLength: 2000
        productId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        warehouseId:
          type: string
          description: >-
            Verilirse productId zorunludur. İkisi birlikte bu satır için stok
            hareketi oluşturur.
          pattern: ^[a-f0-9A-F]{24}$
        quantity:
          description: Pozitif miktar; en fazla 6 basamak.
          oneOf:
            - type: number
              minimum: 0
              maximum: 999999.999999
              multipleOf: 0.000001
              exclusiveMinimum: true
            - type: string
              pattern: >-
                ^(?=\d{1,12}(?:\.\d{1,6})?$)(?!0+(?:\.0+)?$)0*\d{1,6}(?:\.\d{1,6})?$
          x-decimal-places: 6
        unitCode:
          type: string
          description: GET /accounting/options birim kodu; varsayılan C62.
          maxLength: 10
        unitPrice:
          description: KDV hariç birim fiyat; en fazla 6 basamak.
          oneOf:
            - type: number
              minimum: 0
              maximum: 999999999.999999
              multipleOf: 0.000001
            - type: string
              pattern: ^(?=\d{1,12}(?:\.\d{1,6})?$)0*\d{1,9}(?:\.\d{1,6})?$
          x-decimal-places: 6
        discountAmount:
          $ref: '#/components/schemas/AccountingMoney'
        discountPercent:
          $ref: '#/components/schemas/AccountingPercent'
        vatRate:
          $ref: '#/components/schemas/AccountingPercent'
        withholdingPercent:
          allOf:
            - $ref: '#/components/schemas/AccountingPercent'
          description: >-
            KDV tutarından kesilecek yüzde; varsayılan 0. Vergi matrahının
            yüzdesi değildir.
      required:
        - name
        - quantity
        - unitPrice
      additionalProperties: false
      description: >-
        discountAmount ile discountPercent birlikte gönderilemez. Fiyat KDV
        hariçtir. name, quantity, unitPrice zorunlu; diğer parasal/oransal
        alanların varsayılanı 0.
    AccountingInvoiceLine:
      type: object
      properties:
        productId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        warehouseId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        name:
          type: string
        description:
          type: string
        quantity:
          type: number
        unitCode:
          type: string
        unitPrice:
          type: number
        grossAmount:
          type: number
        discountAmount:
          type: number
          description: Satır ve belge indirimi payının toplamı.
        vatRate:
          type: number
        vatAmount:
          type: number
        withholdingPercent:
          type: number
        withheldVatAmount:
          type: number
        lineTotal:
          type: number
      required:
        - name
        - description
        - quantity
        - unitCode
        - unitPrice
        - grossAmount
        - discountAmount
        - vatRate
        - vatAmount
        - withholdingPercent
        - withheldVatAmount
        - lineTotal
      additionalProperties: false
    AccountingInvoiceTotals:
      type: object
      properties:
        grossAmount:
          type: number
        lineDiscountAmount:
          type: number
        documentDiscountAmount:
          type: number
        discountAmount:
          type: number
        taxes:
          type: array
          items:
            $ref: '#/components/schemas/AccountingTaxTotal'
        withheldVatAmount:
          type: number
        payableAmount:
          type: number
      required:
        - grossAmount
        - lineDiscountAmount
        - documentDiscountAmount
        - discountAmount
        - taxes
        - withheldVatAmount
        - payableAmount
      additionalProperties: false
    ApiOperationReceipt:
      type: object
      properties:
        resultId:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        transactionId:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        uuid:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        id:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        providerId:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        documentId:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        paymentId:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        orderId:
          type: string
          minLength: 1
          maxLength: 200
          pattern: ^[A-Za-z0-9_.:-]+$
        uuids:
          type: array
          items:
            type: string
            maxLength: 200
            pattern: ^[A-Za-z0-9_.:-]+$
          maxItems: 100
        sourcePaymentId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
        destinationPaymentId:
          type: string
          description: 24 karakterli kayıt kimliği.
          pattern: ^[a-f0-9A-F]{24}$
      additionalProperties: false
    Error:
      type: object
      properties:
        status:
          type: boolean
        code:
          type: string
        message:
          type: string
        description:
          type: string
        retryable:
          type: boolean
        reviewRequired:
          type: boolean
        operationId:
          type: string
      required:
        - status
      additionalProperties: true
    RateLimitError:
      type: object
      properties:
        status:
          type: integer
          enum:
            - 429
        error:
          type: string
        message:
          type: string
      required:
        - status
        - error
        - message
    AccountingPercent:
      description: 0–100; en fazla 4 ondalık basamak.
      oneOf:
        - type: number
          minimum: 0
          maximum: 100
          multipleOf: 0.0001
        - type: string
          pattern: >-
            ^(?=\d{1,12}(?:\.\d{1,4})?$)0*(?:\d{1,2}(?:\.\d{1,4})?|100(?:\.0{1,4})?)$
      x-decimal-places: 4
    AccountingTaxTotal:
      type: object
      properties:
        code:
          type: string
        rate:
          type: number
        amount:
          type: number
      required:
        - code
        - rate
        - amount
      additionalProperties: false
  responses:
    Unauthorized:
      description: API kimliği/parolası, erişim süresi veya firma doğrulanamadı.
      headers:
        WWW-Authenticate:
          schema:
            type: string
          description: Basic realm="Muhasip API", charset="UTF-8"
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: false
            code: UNAUTHORIZED
            message: API kimlik bilgileri doğrulanamadı.
    Forbidden:
      description: Ürün, IP, modül izni veya kaynak kapsamı uygun değil.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: false
            message: Ürün, IP, modül izni veya kaynak kapsamı uygun değil.
    NotFound:
      description: Kayıt bulunamadı veya bu erişim bağlamında kullanılamıyor.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: false
    RateLimited:
      description: Ortak istek sınırı aşıldı; sayısal status alanı kullanılır.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          example:
            status: 429
            error: Too Many Requests
            message: Rate limit exceeded. Please try again later.
    InternalError:
      description: İşleme hatası. Bazı işleme hataları 411 olarak dönebilir.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: false
            message: Üzgünüz, bir hata oluştu.
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: >-
        Kullanıcı adı apiUserId, parola secretKey. Aktif ve süresi geçmemiş API
        kullanıcısı ve uygun firma gerekir.

````

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