> ## 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.

# GİB e-Arşiv işlemi yürütün

> Yalnız logout,getUserData,query,html,download,cancel,verifyPhoneNumber,sign,send türleri kabul edilir.

<Note>
  Mali işlem sonucunu ve varsa `operationId` değerini saklayın. Zaman aşımında veya `review_required` durumunda otomatik
  tekrar yapmayın. Tamamlanmış tekrar cevabı ilk cevabın bütün gövdesini yeniden sunmaz. [İşlem
  takibi](/rehberler/islem-takibi)
</Note>

## Ne yapar?

Yalnız logout,getUserData,query,html,download,cancel,verifyPhoneNumber,sign,send türleri kabul edilir. query için giden/itiraz ve sıralı iki ISO tarih; html/download için UUID ve signed boolean zorunludur. send ve verifyPhoneNumber Idempotency-Key ister.

İptal belge tarihindeki hesaba ait listede doğrulanır; sağlayıcı iptali kesinleşmeden yerel bağ kaldırılmaz. sign yalnız GİB sonuc=1 ile başarı sayılır. send kesin ETTN sunamazsa 502 review\_required döner; rastgele veya son listedeki belge UUID değeri kullanılmaz.

İşlem takibi: yanıttaki operation makbuzunu saklayın; replayed=true cevabı ilk yanıtın bütün içeriğini tekrar etmez. İmzada aynı ETTN+OID farklı SMS koduyla tekrar kullanılırsa 409; kesin yanlış koddan sonra yeni SMS challenge/oid alınmalıdır.

## Ön koşullar ve izin

`func=getUserData|query|html|download` için `muhasip:earsiv:read`; diğer belgelenmiş türler için `muhasip:earsiv:write` gerekir. `send` ve `verifyPhoneNumber` için `Idempotency-Key` zorunludur.

İlişkili kayıtlar aynı firmaya ait olmalıdır. Erişim ayarları için [kimlik ve izinler](/baslangic/kimlik-ve-izinler) rehberini inceleyin.

**İşlem anahtarı:** func=send veya verifyPhoneNumber için zorunlu. Aynı işlem için aynı anahtarı kullanın; örnekler `MUHASIP_IDEMPOTENCY_KEY` ortam değişkenini kullanır.

[İstek ve cevap şemalarını indirin](/openapi.json).

## İstek örnekleri

Örnekler temsilîdir. Kimlikleri, belge tarihlerini ve iş verisini kendi yetkili kayıtlarınızla değiştirin. Node.js örnekleri **Node.js 20 veya üzeri** içindir; PHP örnekleri cURL uzantısını kullanır. Hiçbiri otomatik tekrar yapmaz.

<Tabs>
  <Tab title="query">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "query",
        "type": "giden",
        "date": [
          "2026-10-01",
          "2026-10-18"
        ]
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "query",
        "type": "giden",
        "date": [
          "2026-10-01",
          "2026-10-18"
        ]
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "query",
            type: "giden",
            date: ["2026-10-01", "2026-10-18"]
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="html">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "html",
        "uuid": "00000000-0000-4000-8000-000000000001",
        "signed": false
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "html",
        "uuid": "00000000-0000-4000-8000-000000000001",
        "signed": false
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "html",
            uuid: "00000000-0000-4000-8000-000000000001",
            signed: false
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="download">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "download",
        "uuid": "00000000-0000-4000-8000-000000000001",
        "signed": true
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "download",
        "uuid": "00000000-0000-4000-8000-000000000001",
        "signed": true
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "download",
            uuid: "00000000-0000-4000-8000-000000000001",
            signed: true
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="send">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header "Idempotency-Key: $MUHASIP_IDEMPOTENCY_KEY" \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "send",
        "CustomerInfo": {
          "Name": "Örnek İşletme",
          "Address": "Örnek adres",
          "District": "Çankaya",
          "City": "Ankara"
        },
        "InvoiceType": "SATIS",
        "issueDate": "2026-10-18",
        "currencyCode": "TRY",
        "description": "Örnek satış",
        "total": {
          "linesTotal": 100,
          "linesAllowanceTotal": 0,
          "taxesTotals": [
            {
              "taxCode": "0015",
              "total": 20
            }
          ],
          "payableAmount": 120
        },
        "lines": [
          {
            "name": "Örnek hizmet",
            "quantity": 1,
            "unitType": "C62",
            "price": 100,
            "total": 100,
            "allowanceTotal": 0,
            "KDVPercent": 20,
            "KDVTotal": 20,
            "taxes": [
              {
                "taxCode": "0015",
                "total": 20,
                "percent": 20
              }
            ]
          }
        ]
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $operationKey = getenv('MUHASIP_IDEMPOTENCY_KEY');
      if (!$operationKey) {
          throw new RuntimeException('Kalıcı işleme ait tekrar anahtarı eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json', 'Idempotency-Key: ' . $operationKey];
      $body = <<<'JSON'
      {
        "func": "send",
        "CustomerInfo": {
          "Name": "Örnek İşletme",
          "Address": "Örnek adres",
          "District": "Çankaya",
          "City": "Ankara"
        },
        "InvoiceType": "SATIS",
        "issueDate": "2026-10-18",
        "currencyCode": "TRY",
        "description": "Örnek satış",
        "total": {
          "linesTotal": 100,
          "linesAllowanceTotal": 0,
          "taxesTotals": [
            {
              "taxCode": "0015",
              "total": 20
            }
          ],
          "payableAmount": 120
        },
        "lines": [
          {
            "name": "Örnek hizmet",
            "quantity": 1,
            "unitType": "C62",
            "price": 100,
            "total": 100,
            "allowanceTotal": 0,
            "KDVPercent": 20,
            "KDVTotal": 20,
            "taxes": [
              {
                "taxCode": "0015",
                "total": 20,
                "percent": 20
              }
            ]
          }
        ]
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const operationKey = process.env.MUHASIP_IDEMPOTENCY_KEY
        if (!operationKey) throw new Error("Kalıcı işleme ait tekrar anahtarı eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Idempotency-Key": operationKey,
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "send",
            CustomerInfo: {
              Name: "Örnek İşletme",
              Address: "Örnek adres",
              District: "Çankaya",
              City: "Ankara"
            },
            InvoiceType: "SATIS",
            issueDate: "2026-10-18",
            currencyCode: "TRY",
            description: "Örnek satış",
            total: {
              linesTotal: 100,
              linesAllowanceTotal: 0,
              taxesTotals: [
                {
                  taxCode: "0015",
                  total: 20
                }
              ],
              payableAmount: 120
            },
            lines: [
              {
                name: "Örnek hizmet",
                quantity: 1,
                unitType: "C62",
                price: 100,
                total: 100,
                allowanceTotal: 0,
                KDVPercent: 20,
                KDVTotal: 20,
                taxes: [
                  {
                    taxCode: "0015",
                    total: 20,
                    percent: 20
                  }
                ]
              }
            ]
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="verifyPhoneNumber">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header "Idempotency-Key: $MUHASIP_IDEMPOTENCY_KEY" \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "verifyPhoneNumber"
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $operationKey = getenv('MUHASIP_IDEMPOTENCY_KEY');
      if (!$operationKey) {
          throw new RuntimeException('Kalıcı işleme ait tekrar anahtarı eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json', 'Idempotency-Key: ' . $operationKey];
      $body = <<<'JSON'
      {
        "func": "verifyPhoneNumber"
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const operationKey = process.env.MUHASIP_IDEMPOTENCY_KEY
        if (!operationKey) throw new Error("Kalıcı işleme ait tekrar anahtarı eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Idempotency-Key": operationKey,
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "verifyPhoneNumber"
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="sign">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "sign",
        "smsCode": "123456",
        "oid": "ORNEK_SMS_ISLEM_KIMLIGI",
        "data": {
          "ettn": "00000000-0000-4000-8000-000000000001"
        }
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "sign",
        "smsCode": "123456",
        "oid": "ORNEK_SMS_ISLEM_KIMLIGI",
        "data": {
          "ettn": "00000000-0000-4000-8000-000000000001"
        }
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "sign",
            smsCode: "123456",
            oid: "ORNEK_SMS_ISLEM_KIMLIGI",
            data: {
              ettn: "00000000-0000-4000-8000-000000000001"
            }
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="cancel">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "cancel",
        "reason": "Örnek iptal gerekçesi",
        "data": {
          "ettn": "00000000-0000-4000-8000-000000000001",
          "belgeTarihi": "18/10/2026"
        }
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "cancel",
        "reason": "Örnek iptal gerekçesi",
        "data": {
          "ettn": "00000000-0000-4000-8000-000000000001",
          "belgeTarihi": "18/10/2026"
        }
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "cancel",
            reason: "Örnek iptal gerekçesi",
            data: {
              ettn: "00000000-0000-4000-8000-000000000001",
              belgeTarihi: "18/10/2026"
            }
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="getUserData">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "getUserData"
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "getUserData"
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "getUserData"
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>

  <Tab title="logout">
    <CodeGroup>
      ```bash cURL theme={null}
      curl --request PATCH 'https://api.muhasip.pro/apps/earsiv' \
        --user "$MUHASIP_API_USER_ID:$MUHASIP_API_SECRET" \
        --header 'Accept: */*' \
        --header 'Content-Type: application/json' \
        --data-binary @- <<'JSON'
      {
        "func": "logout"
      }
      JSON
      ```

      ```php PHP theme={null}
      <?php
      $apiUserId = getenv('MUHASIP_API_USER_ID');
      $secretKey = getenv('MUHASIP_API_SECRET');
      if (!$apiUserId || !$secretKey) {
          throw new RuntimeException('API kimlik bilgileri eksik.');
      }
      $headers = ['Accept: */*', 'Content-Type: application/json'];
      $body = <<<'JSON'
      {
        "func": "logout"
      }
      JSON;
      $handle = curl_init('https://api.muhasip.pro/apps/earsiv');
      curl_setopt_array($handle, [
          CURLOPT_CUSTOMREQUEST => 'PATCH',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_FOLLOWLOCATION => false,
          CURLOPT_HTTPHEADER => $headers,
          CURLOPT_CONNECTTIMEOUT => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
          CURLOPT_USERPWD => $apiUserId . ':' . $secretKey,
          CURLOPT_POSTFIELDS => $body,
      ]);
      $response = curl_exec($handle);
      $httpStatus = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
      curl_close($handle);
      if ($response === false) {
          throw new RuntimeException('Bağlantı tamamlanamadı; mali işlemi otomatik tekrarlamayın.');
      }
      if ($httpStatus < 200 || $httpStatus >= 300) {
          throw new RuntimeException('HTTP ' . $httpStatus . '; kaynak hata açıklamasını değerlendirin.');
      }
      // $response gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
      echo 'HTTP ' . $httpStatus . PHP_EOL;
      ```

      ```javascript Node.js theme={null}
      async function main() {
        const apiUserId = process.env.MUHASIP_API_USER_ID
        const secretKey = process.env.MUHASIP_API_SECRET
        if (!apiUserId || !secretKey) throw new Error("API kimlik bilgileri eksik.")
        const response = await fetch("https://api.muhasip.pro/apps/earsiv", {
          method: "PATCH",
          redirect: "manual",
          headers: {
            Accept: "*/*",
            Authorization: "Basic " + Buffer.from(`${apiUserId}:${secretKey}`).toString("base64"),
            "Content-Type": "application/json"
          },
          body: JSON.stringify({
            func: "logout"
          }),
          signal: AbortSignal.timeout(30000)
        })
        const data = await response.arrayBuffer()
        if (!response.ok) throw new Error(`HTTP ${response.status}; kaynak hata açıklamasını değerlendirin.`)
        // data gövdesini bu işlemin cevap biçimine göre işleyin; ham cevabı loglamayın.
        console.log("HTTP", response.status)
      }

      main().catch(() => {
        console.error("İstek tamamlanamadı; mali işlemi otomatik tekrarlamayın.")
        process.exitCode = 1
      })
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Cevabı değerlendirin

Önce HTTP durumunu, ardından bu kaynağın `status` ve sonuç alanlarını değerlendirin. Bütün uçlar aynı sonuç zarfını veya oluşturma için `201` kodunu kullanmaz.

Temsilî başarılı cevap; gerçek hizmet çağrısından alınmamıştır:

```json theme={null}
{
  "status": true,
  "result": []
}
```

`replayed:true` varsa cevap güvenli makbuz ve sonuç kimlikleriyle sınırlı olabilir. İlk HTML/PDF veya mali gövdeyi tekrar beklemeyin. `reviewRequired:true` veya `retryable:false` yeni bir mali çağrı izni değildir.

## Hata durumunda

| HTTP | Bu işlemde anlamı | İzlenecek adım |
| - | - | - |
| 400 | İstek alanları geçersiz. | Alan adını, türünü ve zorunluluğunu kontrol edin; değişmeyen hatalı isteği tekrar göndermeyin. |
| 401 | API kimliği/parolası, erişim süresi veya firma doğrulanamadı. | Anahtar kimliğini, gizli değeri, erişim süresini ve firma erişimini kontrol edin. |
| 403 | API izni, IP kısıtı veya kayıt erişimi uygun değil. | Anahtarın izinlerini, IP kısıtını ve kayıt kimliğini kontrol edin. |
| 406 | Hesap bulunamadı / GİB oturumu açılamadı. | GİB bağlantısı ve hesap oturumunu kontrol edin; mali isteği körlemesine tekrarlamayın. |
| 409 | İstek, devam eden işlemle veya kayıt durumuyla çakışıyor. | Mevcut işlem ve hedefi inceleyin. Kilit veya içerik çatışmasını yeni anahtarla aşmaya çalışmayın. |
| 422 | İstek iş kuralına uymuyor veya işlem reddedildi. | Ret nedenini kontrol edin. Alanlar hatalıysa düzeltin; desteklenmeyen işlemi yeniden göndermeyin. |
| 429 | Ortak istek sınırı aşıldı; sayısal status alanı kullanılır. | Varsa Retry-After bilgisini değerlendirin. Mali çağrıyı otomatik yeniden göndermeyin. |
| 500 | İşlem gerçekleştirilemedi. | İşlem sonucunu inceleyin; bağlantı/hata oluşması mali etkinin hiç başlamadığını kanıtlamaz. |
| 502 | Hizmet yanıtı alınamadı veya mali sonuç kesinleşmedi. | İşlem makbuzunu ve ilgili belge/ödemeyi inceleyin. Belirsiz mali sonucu yeniden göndermeyin. |
| 503 | İşlem kaydına veya gerekli hizmete erişilemiyor. | Varsa işlem kimliğiyle durumu okuyun; kayıt veya hizmet hatasından otomatik tekrar sonucu çıkarmayın. |

Ağ kesintisi, zaman aşımı veya JSON olmayan cevap mali etkinin oluşmadığını kanıtlamaz. Ham istek/cevapları genel loglara yazmayın. [Hata yönetimi](/rehberler/hata-yonetimi)

## Sonraki adım

İşlem makbuzunu saklayın; durum adresinden kontrol edin ve sonuç kimliklerini ilgili belge/tahsilat/siparişle eşleştirin. reviewRequired=true ise yeniden göndermeden manuel inceleyin.

[Kaynak akışı](/rehberler/kaynaklar/e-arsiv) · [İşlem takibi](/rehberler/islem-takibi) · [Kapsam ve sınırlamalar](/rehberler/kapsam-ve-sinirlamalar)


## OpenAPI

````yaml openapi.json PATCH /apps/earsiv
openapi: 3.0.3
info:
  title: Muhasip API
  version: 2026-10-18.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ı.
paths:
  /apps/earsiv:
    patch:
      tags:
        - GİB e-Arşiv
      summary: GİB e-Arşiv işlemi yürütün
      description: >-
        Yalnız
        logout,getUserData,query,html,download,cancel,verifyPhoneNumber,sign,send
        türleri kabul edilir. query için giden/itiraz ve sıralı iki ISO tarih;
        html/download için UUID ve signed boolean zorunludur. send ve
        verifyPhoneNumber Idempotency-Key ister. İptal belge tarihindeki hesaba
        ait listede doğrulanır; sağlayıcı iptali kesinleşmeden yerel bağ
        kaldırılmaz. sign yalnız GİB sonuc=1 ile başarı sayılır. send kesin ETTN
        sunamazsa 502 review_required döner; rastgele veya son listedeki belge
        UUID değeri kullanılmaz. İşlem takibi: yanıttaki operation makbuzunu
        saklayın; replayed=true cevabı ilk yanıtın bütün içeriğini tekrar etmez.
        İmzada aynı ETTN+OID farklı SMS koduyla tekrar kullanılırsa 409; kesin
        yanlış koddan sonra yeni SMS challenge/oid alınmalıdır.
      operationId: paymentsExecuteEArchiveAction
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 1
            maxLength: 128
            pattern: ^[!-~]+$
          description: func=send veya verifyPhoneNumber için zorunlu.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentsEArchiveActionInput'
            examples:
              query:
                summary: query
                value:
                  func: query
                  type: giden
                  date:
                    - '2026-10-01'
                    - '2026-10-18'
              html:
                summary: html
                value:
                  func: html
                  uuid: 00000000-0000-4000-8000-000000000001
                  signed: false
              download:
                summary: download
                value:
                  func: download
                  uuid: 00000000-0000-4000-8000-000000000001
                  signed: true
              send:
                summary: send
                value:
                  func: send
                  CustomerInfo:
                    Name: Örnek İşletme
                    Address: Örnek adres
                    District: Çankaya
                    City: Ankara
                  InvoiceType: SATIS
                  issueDate: '2026-10-18'
                  currencyCode: TRY
                  description: Örnek satış
                  total:
                    linesTotal: 100
                    linesAllowanceTotal: 0
                    taxesTotals:
                      - taxCode: '0015'
                        total: 20
                    payableAmount: 120
                  lines:
                    - name: Örnek hizmet
                      quantity: 1
                      unitType: C62
                      price: 100
                      total: 100
                      allowanceTotal: 0
                      KDVPercent: 20
                      KDVTotal: 20
                      taxes:
                        - taxCode: '0015'
                          total: 20
                          percent: 20
              verifyPhoneNumber:
                summary: verifyPhoneNumber
                value:
                  func: verifyPhoneNumber
              sign:
                summary: sign
                value:
                  func: sign
                  smsCode: '123456'
                  oid: ORNEK_SMS_ISLEM_KIMLIGI
                  data:
                    ettn: 00000000-0000-4000-8000-000000000001
              cancel:
                summary: cancel
                value:
                  func: cancel
                  reason: Örnek iptal gerekçesi
                  data:
                    ettn: 00000000-0000-4000-8000-000000000001
                    belgeTarihi: 18/10/2026
              getUserData:
                summary: getUserData
                value:
                  func: getUserData
              logout:
                summary: logout
                value:
                  func: logout
      responses:
        '200':
          description: İşlem sonucu.
          content:
            application/json:
              schema:
                anyOf:
                  - allOf:
                      - $ref: '#/components/schemas/PaymentsEArchiveActionResponse'
                      - type: object
                        properties:
                          operation:
                            $ref: '#/components/schemas/ApiOperation'
                          operations:
                            type: array
                            items:
                              $ref: '#/components/schemas/ApiOperation'
                          replayed:
                            type: boolean
                  - $ref: '#/components/schemas/ApiOperationReplay'
                description: >-
                  İlk çağrı kaynağa özgü yanıtı ve işlem makbuzunu; tamamlanmış
                  tekrar yalnız güvenli makbuzu ve uygun sonuç kimliklerini
                  döndürür.
              example:
                status: true
                result: []
        '400':
          description: İstek alanları geçersiz.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: false
                message: İstek alanları geçersiz.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '406':
          description: Hesap bulunamadı / GİB oturumu açılamadı.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: false
                message: Hesap bulunamadı / GİB oturumu açılamadı.
        '409':
          description: >-
            İşlem koruması veya mali sonuç; kaynak varyantının koşullarını
            değerlendirin.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: OPERATION_IN_PROGRESS
                message: İşlem sonucunu durum adresinden kontrol ediniz.
                retryable: false
        '422':
          description: >-
            İşlem koruması veya mali sonuç; kaynak varyantının koşullarını
            değerlendirin.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: OPERATION_REJECTED
                message: İşlem sonucunu durum adresinden kontrol ediniz.
                retryable: false
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: İşlem gerçekleştirilemedi.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: false
                message: İşlem gerçekleştirilemedi.
        '502':
          description: >-
            İşlem koruması veya mali sonuç; kaynak varyantının koşullarını
            değerlendirin.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: UPSTREAM_RESULT_UNCERTAIN
                message: İşlem sonucunu durum adresinden kontrol ediniz.
                retryable: false
        '503':
          description: >-
            İşlem koruması veya mali sonuç; kaynak varyantının koşullarını
            değerlendirin.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiOperationError'
              example:
                status: false
                code: OPERATION_RECORD_UNAVAILABLE
                message: İşlem sonucunu durum adresinden kontrol ediniz.
                retryable: false
components:
  schemas:
    PaymentsEArchiveActionInput:
      oneOf:
        - $ref: '#/components/schemas/PaymentsEArchiveLogoutInput'
        - $ref: '#/components/schemas/PaymentsEArchiveUserInput'
        - $ref: '#/components/schemas/PaymentsEArchiveQueryInput'
        - $ref: '#/components/schemas/PaymentsEArchiveHtmlInput'
        - $ref: '#/components/schemas/PaymentsEArchiveDownloadInput'
        - $ref: '#/components/schemas/PaymentsEArchiveCancelInput'
        - $ref: '#/components/schemas/PaymentsEArchiveVerifyPhoneInput'
        - $ref: '#/components/schemas/PaymentsEArchiveSignInput'
        - $ref: '#/components/schemas/PaymentsEArchiveSendInput'
      description: >-
        Yalnız listelenen func değerleri desteklenir. Bilinmeyen func/type yanıt
        üretmeyebilir.
    PaymentsEArchiveActionResponse:
      anyOf:
        - type: object
          properties:
            status:
              type: boolean
            message:
              type: string
          additionalProperties: true
          required:
            - status
            - message
        - type: object
          properties:
            status:
              type: boolean
            result:
              $ref: '#/components/schemas/PaymentsEArchiveUser'
          additionalProperties: true
          required:
            - status
        - type: object
          properties:
            status:
              type: boolean
            result:
              type: array
              items:
                $ref: '#/components/schemas/PaymentsEArchiveDocument'
          additionalProperties: true
          required:
            - status
        - type: object
          properties:
            status:
              type: boolean
            result:
              type: string
              description: HTML belge içeriği.
            url:
              type: string
              format: uri
              nullable: true
            fileInfo:
              $ref: '#/components/schemas/PaymentsEArchiveFileInfo'
            contacts:
              type: object
              properties:
                _id:
                  type: string
                  description: Kayıt kimliği.
                  pattern: ^[a-fA-F0-9]{24}$
                name:
                  type: string
                email:
                  type: string
                phone:
                  type: string
                  nullable: true
              additionalProperties: true
              nullable: true
            whatsapp:
              type: object
              nullable: true
              description: Bu API yanıtında daima null.
          additionalProperties: true
          required:
            - status
        - type: object
          properties:
            status:
              type: boolean
            result:
              $ref: '#/components/schemas/PaymentsEArchiveDownload'
          additionalProperties: true
          required:
            - status
        - type: object
          properties:
            status:
              type: boolean
            result:
              $ref: '#/components/schemas/PaymentsEArchivePhoneResult'
          additionalProperties: true
          required:
            - status
        - type: object
          properties:
            status:
              type: boolean
            result:
              oneOf:
                - type: string
                - type: boolean
                - type: object
                  properties:
                    sonuc:
                      type: string
                    msg:
                      type: string
                  additionalProperties: true
                  description: GİB iptal sonucu; sağlayıcıya göre değişebilir.
          additionalProperties: true
          required:
            - status
        - type: object
          properties:
            status:
              type: boolean
            result:
              $ref: '#/components/schemas/PaymentsEArchiveDraftResult'
            invoiceDetails:
              $ref: '#/components/schemas/PaymentsEArchiveCalculatedInvoice'
          additionalProperties: true
          required:
            - status
      description: >-
        logout/sign message; getUserData kullanıcı; query dizi; html HTML ve
        dosya alanları; download dosya sonucu; cancel GİB sonucu;
        verifyPhoneNumber phone/oid; send taslak sonucu.
    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
      required:
        - status
        - replayed
        - operation
        - operations
      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
    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
    PaymentsEArchiveLogoutInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - logout
      additionalProperties: true
      description: GİB oturumu açılır ve kapatılır.
      required:
        - func
    PaymentsEArchiveUserInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - getUserData
      additionalProperties: true
      required:
        - func
    PaymentsEArchiveQueryInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - query
        type:
          type: string
          enum:
            - giden
            - itiraz
        date:
          type: array
          items:
            type: string
            format: date
          minItems: 2
          maxItems: 2
      additionalProperties: true
      required:
        - func
        - type
        - date
    PaymentsEArchiveHtmlInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - html
        uuid:
          type: string
          format: uuid
        signed:
          type: boolean
      additionalProperties: true
      required:
        - func
        - uuid
        - signed
    PaymentsEArchiveDownloadInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - download
        uuid:
          type: string
          format: uuid
        signed:
          type: boolean
      additionalProperties: true
      required:
        - func
        - uuid
        - signed
    PaymentsEArchiveCancelInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - cancel
        reason:
          type: string
          minLength: 1
          maxLength: 1000
        data:
          allOf:
            - $ref: '#/components/schemas/PaymentsEArchiveDocument'
            - type: object
              required:
                - ettn
                - belgeTarihi
              properties:
                ettn:
                  type: string
                  format: uuid
                belgeTarihi:
                  type: string
                  description: DD/MM/YYYY, DD-MM-YYYY veya YYYY-MM-DD
      additionalProperties: true
      description: >-
        data.ettn geçerli UUID, data.belgeTarihi iptal edilecek belgenin gerçek
        tarihi olmalıdır: DD/MM/YYYY, DD-MM-YYYY veya YYYY-MM-DD. Belge o gün
        bağlı hesabın listesinde doğrulanır.
      required:
        - func
        - reason
        - data
    PaymentsEArchiveVerifyPhoneInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - verifyPhoneNumber
      additionalProperties: true
      description: Hesaba kayıtlı telefona SMS kodu gönderilir.
      required:
        - func
    PaymentsEArchiveSignInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - sign
        smsCode:
          type: string
          pattern: ^\d{4,8}$
        oid:
          type: string
          minLength: 1
          maxLength: 200
        data:
          allOf:
            - $ref: '#/components/schemas/PaymentsEArchiveDocument'
            - type: object
              required:
                - ettn
              properties:
                ettn:
                  type: string
                  format: uuid
      additionalProperties: true
      required:
        - func
        - smsCode
        - oid
        - data
      description: >-
        data.ettn geçerli belge UUID olmalıdır. oid en fazla 200 karakter,
        smsCode 4–8 rakam metnidir. Aynı belge+oid değişen kodla tekrar
        kullanılamaz 409; kesin redden sonra yeni SMS challenge/oid gerekir.
    PaymentsEArchiveSendInput:
      type: object
      properties:
        func:
          type: string
          enum:
            - send
        issueDate:
          type: string
          format: date
        currencyCode:
          type: string
          pattern: ^[A-Z]{3}$
        exchangeRate:
          type: number
          description: TRY dışında gereklidir.
        InvoiceType:
          type: string
          default: SATIS
        CustomerInfo:
          $ref: '#/components/schemas/PaymentsEArchiveCustomer'
        total:
          $ref: '#/components/schemas/PaymentsEArchiveSendTotals'
        lines:
          type: array
          items:
            $ref: '#/components/schemas/PaymentsEArchiveSendLine'
          minItems: 1
          maxItems: 1000
        description:
          type: string
        Notes:
          type: array
          items:
            type: string
        TaxExemptionReasonInfo:
          type: object
          properties:
            KDVExemptionReasonCode:
              type: string
          additionalProperties: true
          description: ISTISNA türü için gereklidir.
        OrderReference:
          type: object
          properties:
            Value:
              type: string
            IssueDate:
              type: string
              format: date
          additionalProperties: true
        OKCInfo:
          type: object
          properties:
            ID:
              type: string
            IssueDate:
              type: string
              format: date
            Time:
              type: string
            DocumentDescription:
              type: string
            ZNo:
              type: string
            EndPointID:
              type: string
          additionalProperties: true
        ReturnInvoiceInfo:
          type: array
          items:
            type: object
            properties:
              InvoiceNumber:
                type: string
              IssueDate:
                type: string
                format: date
            additionalProperties: true
      additionalProperties: true
      description: >-
        GİB taslağı oluşturur. Zorunlu mali alanlar doğrulanır; TRY dışındaki
        para birimlerinde pozitif exchangeRate gerekir. ISTISNA için istisna
        kodu, TEVKIFAT için withholdingTaxTotal gerekir. Kesin ETTN alınamazsa
        belge UUID dönmeden review_required olur.
      required:
        - func
        - issueDate
        - currencyCode
        - CustomerInfo
        - total
        - lines
    PaymentsEArchiveUser:
      type: object
      properties:
        taxIDOrTRID:
          type: string
        title:
          type: string
        name:
          type: string
        surname:
          type: string
        registryNo:
          type: string
        mersisNo:
          type: string
        taxOffice:
          type: string
        fullAddress:
          type: string
        buildingName:
          type: string
        buildingNumber:
          type: string
        doorNumber:
          type: string
        town:
          type: string
        district:
          type: string
        city:
          type: string
        zipCode:
          type: string
        country:
          type: string
        phoneNumber:
          type: string
        faxNumber:
          type: string
        email:
          type: string
        webSite:
          type: string
        businessCenter:
          type: string
      additionalProperties: true
      description: GİB kullanıcı bilgileri; doluluk hesaba göre değişir.
    PaymentsEArchiveDocument:
      type: object
      properties:
        ettn:
          type: string
        belgeNumarasi:
          type: string
        aliciVknTckn:
          type: string
        aliciUnvanAdSoyad:
          type: string
        belgeTarihi:
          type: string
        belgeTuru:
          type: string
        onayDurumu:
          type: string
      additionalProperties: true
      description: >-
        Sorgudan dönen belge tanımlayıcıları; ek sağlayıcı alanları bulunabilir.
        İmzalama/iptalde sorgu kaydı korunur.
    PaymentsEArchiveFileInfo:
      type: object
      properties:
        transactionsId:
          type: string
          description: Kayıt kimliği.
          pattern: ^[a-fA-F0-9]{24}$
      additionalProperties: true
      description: >-
        Belge dosyasının bilgileri. Muhasip kaydıyla eşleşirse transactionsId
        bulunur. Diğer alanları işlem cevabına göre değerlendirin.
    PaymentsEArchiveDownload:
      type: object
      properties:
        status:
          type: boolean
        url:
          type: string
          format: uri
          nullable: true
        fileInfo:
          $ref: '#/components/schemas/PaymentsEArchiveFileInfo'
        message:
          type: string
      additionalProperties: true
      description: >-
        Belge indirme sonucu. İçeriği kullanmadan önce başarı durumunu ve dönen
        alanları kontrol edin.
    PaymentsEArchivePhoneResult:
      type: object
      properties:
        phone:
          type: string
          description: SMS gönderilen telefon.
          nullable: true
        oid:
          type: string
          description: SMS işlem kimliği.
          nullable: true
      additionalProperties: true
      required:
        - phone
        - oid
    PaymentsEArchiveDraftResult:
      type: object
      properties:
        status:
          type: boolean
        message:
          type: string
        uuid:
          type: string
          format: uuid
      additionalProperties: true
      description: >-
        Yalnız sağlayıcının kesin ETTN kanıtı varsa uuid bulunur; aksi durumda
        başarı yerine review_required işlem hatası döner.
    PaymentsEArchiveCalculatedInvoice:
      type: object
      properties:
        faturaTarihi:
          type: string
        saat:
          type: string
        paraBirimi:
          type: string
        dovzTLkur:
          type: number
        faturaTipi:
          type: string
        vknTckn:
          type: string
        aliciUnvan:
          type: string
        matrah:
          type: number
        malhizmetToplamTutari:
          type: number
        toplamIskonto:
          type: number
        hesaplanankdv:
          type: number
        vergilerToplami:
          type: number
        vergilerDahilToplamTutar:
          type: number
        odenecekTutar:
          type: number
        not:
          type: string
        malHizmetTable:
          type: array
          items:
            $ref: '#/components/schemas/PaymentsEArchiveCalculatedLine'
      additionalProperties: true
      description: >-
        GİB taslağına iletilen hesaplanmış alanlar; istemci toplamları yeniden
        hesaplanmaz.
    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
      additionalProperties: false
    RateLimitError:
      type: object
      properties:
        status:
          type: integer
          enum:
            - 429
        error:
          type: string
        message:
          type: string
      required:
        - status
        - error
        - message
    PaymentsEArchiveCustomer:
      type: object
      properties:
        Name:
          type: string
          description: Alıcı adı/ünvanı.
        TaxNumber:
          type: string
          description: Alıcı vergi/kimlik numarası; boşsa nihai tüketici değeri kullanılır.
        District:
          type: string
          description: İlçe.
        Address:
          type: string
          description: Adres.
        City:
          type: string
          description: İl.
        Country:
          type: string
          description: Ülke; boşsa TÜRKİYE.
        Phone:
          type: string
          description: Telefon.
        Mail:
          type: string
          description: E-posta.
        TaxOffice:
          type: string
          description: Vergi dairesi; boşsa City.
      additionalProperties: true
      required:
        - Name
    PaymentsEArchiveSendTotals:
      type: object
      properties:
        linesTotal:
          type: number
        linesAllowanceTotal:
          type: number
        taxesTotals:
          type: array
          items:
            $ref: '#/components/schemas/PaymentsEArchiveTax'
        payableAmount:
          type: number
        withholdingTaxTotal:
          type: number
          description: TEVKIFAT için.
      additionalProperties: true
      required:
        - linesTotal
        - linesAllowanceTotal
        - taxesTotals
        - payableAmount
    PaymentsEArchiveSendLine:
      type: object
      properties:
        name:
          type: string
        quantity:
          type: number
          exclusiveMinimum: true
          minimum: 0
        unitType:
          type: string
          default: C62
        price:
          type: number
        total:
          type: number
        allowancePercent:
          type: number
          default: 0
        allowanceTotal:
          type: number
          description: İskonto yoksa 0 gönderin.
        KDVPercent:
          type: number
        KDVTotal:
          type: number
        withholdingTax:
          $ref: '#/components/schemas/PaymentsEArchiveWithholding'
        taxes:
          type: array
          items:
            $ref: '#/components/schemas/PaymentsEArchiveLineTax'
        specialBasePrice:
          type: number
          description: OZELMATRAH için.
        specialBaseReason:
          type: string
          description: OZELMATRAH için.
      additionalProperties: true
      required:
        - name
        - quantity
        - price
        - total
        - allowanceTotal
        - KDVPercent
        - KDVTotal
        - taxes
    PaymentsEArchiveCalculatedLine:
      type: object
      properties:
        malHizmet:
          type: string
        miktar:
          type: number
        birim:
          type: string
        birimFiyat:
          type: number
        fiyat:
          type: number
        iskontoTutari:
          type: number
        kdvOrani:
          type: number
        kdvTutari:
          type: number
      additionalProperties: true
      description: Özel vergi alanları belgeye göre eklenebilir.
    PaymentsEArchiveTax:
      type: object
      properties:
        taxCode:
          type: string
        percent:
          type: number
        total:
          type: number
      additionalProperties: true
      required:
        - taxCode
        - total
    PaymentsEArchiveWithholding:
      type: object
      properties:
        percent:
          type: number
        taxCode:
          type: string
        total:
          type: number
      additionalProperties: true
      required:
        - percent
        - total
    PaymentsEArchiveLineTax:
      type: object
      properties:
        taxCode:
          type: string
        percent:
          type: number
        total:
          type: number
      additionalProperties: true
      required:
        - taxCode
        - total
        - percent
  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.
    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.
  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.