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

# Perbarui Data Document AI API

> Koreksi kolom yang diekstrak Didit dari dokumen Document AI, atau atur status tinjauannya, pada sesi verifikasi KYC atau KYB.



Perbarui Prompt API Data Document AI
        Salin prompt ke papan klip



      
      

\<pre>

\`Correct the extracted data of a Document AI document, or set its review status, on a Didit verification session through the API.

Endpoint:
PATCH https://verification.didit.me/v3/document-ai/{session_id}/documents/{document_uuid}/

Authentication:
Send my Didit API key in the x-api-key header. A scoped key needs decisions: write.

Goal:
\- Fix a value Document AI misread, or approve or decline a document the workflow sent to review.

Request body (JSON, both fields optional):
\- extracted_data: a JSON object of field keys to new values. Merged key by key: sent keys replace the stored values (a null value clears one), keys I leave out keep their values. Do not send extracted_data itself as null (400); leave it out instead.
\- status: "Approved", "Declined", "In Review" or "Not Finished".

Behavior:
\- Works for user (KYC) and business (KYB) session IDs.
\- {document_uuid} is document_ai_documents[].items[].uuid from GET /v3/session/{session_id}/decision/, and the document must belong to that session.
\- The document status feeds the Document AI result of its workflow node in the decision. The session status is not recomputed.
\- Every successful call, even one that changes nothing, sends a data.updated webhook with trigger "manual_review".

Example call:
curl -X PATCH "https://verification.didit.me/v3/document-ai/11111111-2222-3333-4444-555555555555/documents/44444444-5555-6666-7777-888888888888/" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"extracted_data": {"invoice_number": "INV-2026-0042"}, "status": "Approved"}'

What to read from the response:
\- extracted_data: all extracted fields after the merge.
\- status: the document's review status.
\- file_url: the storage path of the file, not a download link. Read the presigned file_url from the session decision to download it.

Failure modes:
\- 400: status is not one of the allowed values, or extracted_data is null (checked before the document is looked up).
\- 401: the API key has expired.
\- 403: missing key (a wrong, revoked or expired key gets 401), a key of another application, a scoped key without decisions: write, or a request from outside the key's IP allowlist.
\- 404: the session does not exist, was deleted, or is outside a scoped key's limits, or the document does not belong to the session.

Side effects: updates the document and sends a data.updated webhook.

For the full integration shape, see /integration/integration-prompt.`

\</pre>



      
      

Tempel ke

Kunci kolom adalah kunci yang Anda konfigurasikan untuk dokumen di alur kerja. Lihat [Document AI](https://docs.didit.me/id/core-technology/document-ai/overview.md) untuk mengetahui cara dokumen dan kolom dikonfigurasi, serta [laporan Document AI](https://docs.didit.me/id/core-technology/document-ai/report-document-ai.md) untuk melihat lokasi hasilnya pada keputusan sesi.


## OpenAPI

````yaml id/openapi-25.json PATCH /v3/document-ai/{sessionId}/documents/{documentUuid}/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: API Verifikasi Identitas. Lakukan autentikasi dengan header x-api-key.
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/document-ai/{sessionId}/documents/{documentUuid}/:
    patch:
      tags:
        - Sessions
      summary: Perbarui dokumen Document AI
      description: >-
        Koreksi kolom yang diekstrak oleh Document AI dari satu dokumen yang
        diunggah, tetapkan status peninjauannya, atau keduanya, pada sesi KYC
        atau KYB. `extracted_data` harus berupa objek JSON dan digabungkan kunci
        per kunci: kunci yang Anda kirim menggantikan nilai yang tersimpan
        (kunci yang dikirim sebagai `null` disimpan sebagai `null`) dan kunci
        yang Anda abaikan tetap mempertahankan nilainya. Status dokumen
        memengaruhi hasil Document AI dari node alur kerjanya dalam keputusan
        sesi; status sesi itu sendiri tidak dihitung ulang. Setiap panggilan
        yang berhasil, termasuk yang tidak mengubah apa pun, mengirimkan
        [webhook](https://docs.didit.me/id/integration/webhooks) `data.updated`
        dengan pemicu `manual_review`. Kunci API dengan cakupan yang sesuai
        memerlukan `decisions: write`; lihat [Document
        AI](https://docs.didit.me/id/core-technology/document-ai/overview).
      operationId: patch_v3_document_ai_document
      parameters:
        - name: sessionId
          in: path
          required: true
          description: >-
            UUID sesi verifikasi (`session_id` yang dikembalikan oleh `POST
            /v3/session/`). Menerima ID sesi Verifikasi Pengguna (KYC) dan
            Verifikasi Bisnis (KYB): server mencari ID tersebut di kedua jenis
            sesi. Harus berupa UUID dengan format yang benar; nilai yang salah
            format tidak cocok dengan rute dan mengembalikan HTML `404`.
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
        - name: documentUuid
          in: path
          required: true
          description: >-
            UUID dokumen Document AI (`document_ai_documents[].items[].uuid` di
            `GET /v3/session/{sessionId}/decision/`). Dokumen ini harus dimiliki
            oleh sesi di path tersebut.
          schema:
            type: string
            format: uuid
            example: 44444444-5555-6666-7777-888888888888
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                extracted_data:
                  type: object
                  additionalProperties: true
                  description: >-
                    Kunci kolom (kunci yang Anda konfigurasi untuk dokumen)
                    beserta nilai koreksinya. Harus berupa objek JSON;
                    digabungkan kunci demi kunci ke dalam data yang disimpan.
                    Jangan sertakan; jangan kirim `null`, yang akan
                    mengembalikan `400`.
                  example:
                    invoice_number: INV-2026-0042
                status:
                  type: string
                  enum:
                    - Approved
                    - Declined
                    - In Review
                    - Not Finished
                  description: Status peninjauan baru dari dokumen.
                  example: Approved
            example:
              extracted_data:
                invoice_number: INV-2026-0042
              status: Approved
      responses:
        '200':
          description: Dokumen diperbarui. Mengembalikan dokumen setelah penggabungan.
          content:
            application/json:
              schema:
                type: object
                required:
                  - uuid
                  - document_key
                  - original_filename
                  - file_url
                  - status
                  - extracted_data
                properties:
                  uuid:
                    type: string
                    format: uuid
                    description: Pengidentifikasi dokumen.
                  document_key:
                    type: string
                    description: Dokumen terkonfigurasi yang sesuai dengan unggahan ini.
                  original_filename:
                    type: string
                    nullable: true
                    description: Nama file saat dokumen diunggah.
                  file_url:
                    type: string
                    nullable: true
                    description: >-
                      Jalur penyimpanan file yang diunggah. Ini bukan tautan
                      unduhan: baca `file_url` yang telah ditandatangani
                      sebelumnya dari keputusan sesi untuk mengunduh file.
                  status:
                    type: string
                    enum:
                      - Not Finished
                      - Approved
                      - Declined
                      - In Review
                      - Resub Requested
                    description: Status peninjauan dokumen.
                  extracted_data:
                    type: object
                    nullable: true
                    additionalProperties: true
                    description: >-
                      Semua kolom yang diekstrak setelah penggabungan, dengan
                      kunci berdasarkan kunci kolom.
              example:
                uuid: 44444444-5555-6666-7777-888888888888
                document_key: invoice
                original_filename: invoice-2026-09.pdf
                file_url: >-
                  document_ai/11111111-2222-3333-4444-555555555555-66666666-7777-8888-9999-000000000000.pdf
                status: Approved
                extracted_data:
                  invoice_number: INV-2026-0042
                  total_amount: 1250
                  issue_date: '2026-09-01'
        '400':
          description: >-
            Kesalahan validasi, diperiksa sebelum dokumen dicari: `status` bukan
            salah satu dari nilai yang diizinkan, atau `extracted_data` dikirim
            sebagai `null`.
          content:
            application/json:
              examples:
                Invalid status:
                  summary: status tidak ada di dalam enum
                  value:
                    status:
                      - '"Rejected" is not a valid choice.'
                Null extracted_data:
                  summary: extracted_data bernilai null
                  value:
                    extracted_data:
                      - This field may not be null.
        '401':
          description: >-
            Kunci API dengan cakupan terbatas telah kedaluwarsa. Ini
            satu-satunya kasus yang mengembalikan `401`: kunci yang hilang,
            tidak valid, atau dicabut mengembalikan `403`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Pesan kesalahan yang mudah dibaca manusia.
              examples:
                Expired key:
                  summary: Tanggal kedaluwarsa kunci telah lewat
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            Kegagalan autentikasi atau otorisasi. Kunci yang hilang
            mengembalikan `403`, begitu juga dengan kunci dari aplikasi lain,
            kunci dengan cakupan tanpa izin yang dibutuhkan endpoint ini, dan
            permintaan dari luar daftar izin IP kunci tersebut; kunci yang
            salah, dicabut, atau kedaluwarsa mengembalikan `401`. Bedakan
            kegagalan tersebut berdasarkan `detail`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Pesan kesalahan yang mudah dibaca manusia.
              examples:
                Missing or invalid credentials:
                  summary: Tidak ada header x-api-key, atau kunci gagal divalidasi
                  value:
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                Other application:
                  summary: Kunci valid milik aplikasi yang berbeda dari sesi
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without decisions write:
                  summary: 'Kunci ber-scope tidak memiliki decisions: write'
                  value:
                    detail: This API key has no write access to decisions.
                IP not allowed:
                  summary: Permintaan dari luar daftar izin IP kunci
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: >-
            Sesi tidak ada, telah dihapus, atau berada di luar batas kunci
            dengan cakupan terbatas, atau tidak ada dokumen saat ini dengan UUID
            ini yang menjadi miliknya. Pencarian sesi berjalan sebelum
            pemeriksaan kredensial, sehingga `sessionId` yang tidak dikenal
            mengembalikan `404` bahkan tanpa kunci yang valid.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Pesan kesalahan yang mudah dibaca manusia.
              examples:
                Unknown session:
                  summary: Tidak ada sesi dengan ID ini, atau telah dihapus
                  value:
                    detail: Not found.
                Outside key limits:
                  summary: >-
                    Sesi berada di luar batas kunci dengan cakupan terbatas
                    (juga dikembalikan untuk sesi yang baru saja dihapus)
                  value:
                    detail: Session not found.
                Unknown document:
                  summary: documentUuid bukan milik sesi
                  value:
                    detail: Document AI document not found.
        '429':
          description: >-
            Batas laju terlampaui: 300 permintaan penulisan (POST, PATCH,
            DELETE) per menit per kunci API. Tunggu selama `Retry-After` detik
            sebelum mencoba lagi; header `X-RateLimit-*` menunjukkan anggaran
            tersebut.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Pesan kesalahan yang mudah dibaca manusia.
              examples:
                Rate limited:
                  summary: Anggaran untuk menit saat ini habis
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
          headers:
            Retry-After:
              description: Detik untuk menunggu sebelum mencoba lagi.
              schema:
                type: integer
                minimum: 1
                example: 30
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/document-ai/11111111-2222-3333-4444-555555555555/documents/44444444-5555-6666-7777-888888888888/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"extracted_data": {"invoice_number": "INV-2026-0042"}, "status": "Approved"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.update_document_ai_data(
                "11111111-2222-3333-4444-555555555555",
                "44444444-5555-6666-7777-888888888888",
                extracted_data={"invoice_number": "INV-2026-0042"},
                status="Approved",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // Reads DIDIT_API_KEY.
            const didit = new Didit();

            const result = await didit.sessions.updateDocumentAiData(
              "11111111-2222-3333-4444-555555555555",
              "44444444-5555-6666-7777-888888888888",
              {
                extracted_data: { invoice_number: "INV-2026-0042" },
                status: "Approved",
              },
            );
            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.UpdateDocumentAiData(ctx, \"11111111-2222-3333-4444-555555555555\", \"44444444-5555-6666-7777-888888888888\", didit.SessionsUpdateDocumentAiDataParams{\n\tExtractedData: didit.Some(map[string]any{\"invoice_number\": \"INV-2026-0042\"}),\n\tStatus:        didit.Some(didit.SessionsUpdateDocumentAiDataParamsStatus(\"Approved\")),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.util.Map;

            import me.didit.Didit;

            import me.didit.types.SessionsUpdateDocumentAiDataParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().updateDocumentAiData("11111111-2222-3333-4444-555555555555",
            "44444444-5555-6666-7777-888888888888",
            SessionsUpdateDocumentAiDataParams.builder()
                    .extractedData(Map.of("invoice_number", "INV-2026-0042"))
                    .status(SessionsUpdateDocumentAiDataParams.Status.of("Approved"))
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $result =
            $didit->sessions->updateDocumentAiData('11111111-2222-3333-4444-555555555555',
            '44444444-5555-6666-7777-888888888888', [
                'extracted_data' => ['invoice_number' => 'INV-2026-0042'],
                'status' => 'Approved',
            ]);

            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY.
            didit = Didit::Client.new

            result = didit.sessions.update_document_ai_data(
              "11111111-2222-3333-4444-555555555555",
              "44444444-5555-6666-7777-888888888888",
              extracted_data: { invoice_number: "INV-2026-0042" },
              status: "Approved"
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Collections.Generic;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await
            client.Sessions.UpdateDocumentAiDataAsync("11111111-2222-3333-4444-555555555555",
            "44444444-5555-6666-7777-888888888888", new
            SessionsUpdateDocumentAiDataParams

            {
                ExtractedData = new Dictionary<string, object> { ["invoice_number"] = "INV-2026-0042" },
                Status = new SessionsUpdateDocumentAiDataParamsStatus("Approved"),
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Kunci API aplikasi Anda, dari Developers -> API keys di Business
        Console. Kunci utama memiliki akses penuh. Kunci bernama dapat diberi
        cakupan: none, read, atau write per sumber daya, dibatasi pada beberapa
        alur kerja atau pada sesi yang disetujui, pada daftar alamat IP, dan
        pada tanggal kedaluwarsa. 401 berarti kuncinya salah, dicabut, atau
        kedaluwarsa; 403 berarti tidak ada kunci yang dikirimkan, kunci tidak
        memiliki akses ke sumber daya atau tindakan ini, atau permintaan datang
        dari alamat di luar daftar IP-nya; 404 pada rute sesi berarti sesi
        berada di luar alur kerja atau status kunci tersebut. Kunci tanpa akses
        media menerima URL gambar, video, dan PDF sebagai null, dan kunci tanpa
        izin tulis sesi menerima tautan sesi dan token sebagai null. Lihat
        https://docs.didit.me/console/api-keys.

````

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