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

# Tambah Gambar ke Sesi API

> Lampirkan gambar atau PDF tambahan ke hasil Verifikasi Identitas atau Bukti Alamat dari sesi KYC yang sudah selesai, misalnya sisi belakang dokumen. Didit.

Tambahkan Gambar ke Prompt API Sesi
Salin prompt ke papan klip

<pre>
  \`Attach an extra image or PDF to a finished Didit User Verification (KYC) session through the API.

  Endpoint:
  PATCH [https://verification.didit.me/v3/session/\{session\_id}/add-images/](https://verification.didit.me/v3/session/\{session_id}/add-images/)

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

  Goal:

  * Add evidence collected outside the verification flow (for example the back of an ID document, or a supporting letter) to the session's ID verification or Proof of Address result, so reviewers see it with the rest of the session.

  Request (multipart/form-data):

  * file (required): JPG, JPEG, PNG, WEBP, TIFF or PDF, at most 15 MB as uploaded. Didit compresses it and rejects it if it is still over 2 MB (2,097,152 bytes) after compression.
  * model\_type (required): "kyc" for the ID verification, "poa" for the Proof of Address.
  * file\_password (optional): the password of an encrypted PDF.

  Behavior:

  * The session must be Approved, Declined, In Review or Kyc Expired, and must have the result named by model\_type. Business (KYB) sessions are not supported.
  * When the step ran more than once, the file goes to the most recent result.
  * Each call adds one file and keeps the existing ones.
  * The file then appears in extra\_files of id\_verifications\[] or poa\_verifications\[] in GET /v3/session/{session_id}/decision/.
  * A FILE\_ADDED entry is added to the session's activity log. No webhook is sent and the session status does not change.
  * Rate limit: 10 requests per minute per API key.

  Example call:
  curl -X PATCH "[https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/add-images/](https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/add-images/)" \
  -H "x-api-key: YOUR\_API\_KEY" \
  -F "file=@back-of-id.jpg" \
  -F "model\_type=kyc"

  What to read from the response:

  * extra\_files: short-lived presigned links to every extra file of that result, including the new one. A scoped key without media: read receives them as null.

  Failure modes:

  * 400: file or model\_type missing, unsupported format, file too large before or after compression, encrypted PDF without the right file\_password.
  * 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 sessions: write, or a request from outside the key's IP allowlist.
  * 404: the session does not exist, was deleted, is outside a scoped key's limits, is not in a reviewable status, or has no result of that model\_type.
  * 429: more than 10 calls in a minute. Wait for Retry-After seconds.

  Side effects: stores the file with the session and adds an activity entry.

  For the full integration shape, see /integration/integration-prompt.\`
</pre>

Tempel ke

Tautan presigned di `extra_files` akan kedaluwarsa. Ambil tautan baru dari [keputusan sesi](https://docs.didit.me/id/sessions-api/retrieve-session.md) saat Anda membutuhkan file-file tersebut nanti. Untuk mengoreksi data yang diekstrak dari dokumen, gunakan [Perbarui data sesi](https://docs.didit.me/id/sessions-api/update-data.md) sebagai gantinya.


## OpenAPI

````yaml id/openapi-25.json PATCH /v3/session/{sessionId}/add-images/
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/session/{sessionId}/add-images/:
    patch:
      tags:
        - Sessions
      summary: Tambahkan gambar ke sesi
      description: >-
        Lampirkan satu gambar atau PDF tambahan ke hasil Verifikasi Identitas
        (`model_type=kyc`) atau Bukti Alamat (`model_type=poa`) dari sesi
        Verifikasi Pengguna (KYC) yang sudah selesai, misalnya bukti yang
        dikumpulkan di luar alur. Sesi harus berstatus `Approved`, `Declined`,
        `In Review`, atau `Kyc Expired` dan membawa hasil yang ditentukan oleh
        `model_type`; sesi Verifikasi Bisnis (KYB) tidak didukung. Setiap
        panggilan menambahkan satu file (ke hasil terbaru saat langkah tersebut
        berjalan lebih dari sekali), mempertahankan file yang ada, dan mencatat
        entri `FILE_ADDED` di log aktivitas sesi; pengunggahan ini tidak
        mengirim webhook dan tidak mengubah status sesi. File dikompresi saat
        diunggah dan dikembalikan di `extra_files` dari keputusan sesi. Endpoint
        ini dibatasi hingga 10 permintaan per menit per kunci API. Kunci API
        dengan cakupan membutuhkan `sessions: write`, dan tanpa `media: read`
        kunci tersebut menerima tautan `extra_files` sebagai `null`.
      operationId: patch_v3_session_add_images
      parameters:
        - name: sessionId
          in: path
          required: true
          description: >-
            UUID dari sesi Verifikasi Pengguna (KYC) untuk menambahkan file
            (yaitu `session_id` yang dikembalikan oleh `POST /v3/session/`). ID
            sesi Verifikasi Bisnis (KYB) akan mengembalikan `404`.
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - model_type
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    Gambar atau PDF. Ekstensi yang diizinkan: `jpg`, `jpeg`,
                    `png`, `webp`, `tiff`, `pdf`. Maksimal 15 MB saat diunggah;
                    file kemudian dikompresi dan ditolak dengan `400` jika
                    ukurannya masih lebih besar dari 2 MB (2,097,152 byte). File
                    kosong ditolak.
                model_type:
                  type: string
                  enum:
                    - kyc
                    - poa
                  description: >-
                    `kyc` menambahkan file ke hasil Verifikasi Identitas, `poa`
                    ke hasil Bukti Alamat.
                  example: kyc
                file_password:
                  type: string
                  description: >-
                    Kata sandi untuk PDF terenkripsi. Tanpa kata sandi, atau
                    jika salah, PDF terenkripsi mengembalikan `400`.
            example:
              file: (binary)
              model_type: kyc
      responses:
        '200':
          description: >-
            File ditambahkan. Mengembalikan setiap file tambahan dari hasil
            tersebut, termasuk yang baru.
          content:
            application/json:
              schema:
                type: object
                required:
                  - extra_files
                properties:
                  extra_files:
                    type: array
                    description: >-
                      Tautan presigned berdurasi singkat ke semua file tambahan
                      dari hasil yang dinamai oleh `model_type`, dengan yang
                      terlama terlebih dahulu. Setiap tautan bernilai `null`
                      untuk kunci API dengan cakupan terbatas tanpa `media:
                      read`. Baca tautan baru dari keputusan sesi nanti.
                    items:
                      type: string
                      format: uri
                      nullable: true
              example:
                extra_files:
                  - >-
                    https://media.example.com/session/11111111-2222-3333-4444-555555555555/kyc-extra-files/66666666-7777-8888-9999-000000000000.jpg?expires=1789383731&signature=abc123
        '400':
          description: >-
            Kesalahan validasi. Kesalahan kolom diterima sebagai `{"<field>":
            ["<message>"]}`; kesalahan PDF terenkripsi sebagai `{"detail":
            "..."}`.
          content:
            application/json:
              examples:
                Missing file:
                  summary: Tidak ada bagian file di dalam formulir
                  value:
                    file:
                      - No file was submitted.
                Missing model_type:
                  summary: model_type dihilangkan
                  value:
                    model_type:
                      - This field is required.
                Invalid model_type:
                  summary: model_type bukan kyc atau poa
                  value:
                    model_type:
                      - '"passport" is not a valid choice.'
                File too large:
                  summary: Unggahan melebihi 15 MB
                  value:
                    file:
                      - File size should not exceed 15 MB
                Too large after compression:
                  summary: Masih lebih dari 2 MB setelah kompresi
                  value:
                    file:
                      - File size is too big. Max allowed size is 2097152 bytes.
                Encrypted PDF:
                  summary: PDF terenkripsi tanpa file_password
                  value:
                    detail: >-
                      The PDF is encrypted. Please upload a decrypted PDF or a
                      photo instead.
                Wrong PDF password:
                  summary: file_password tidak dapat membuka PDF
                  value:
                    detail: >-
                      The PDF password is incorrect. Please provide the correct
                      password.
        '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 sessions write:
                  summary: 'Kunci ber-scope tidak memiliki sessions: write'
                  value:
                    detail: This API key has no write access to sessions.
                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; merupakan sesi KYB atau tidak berstatus
            `Approved`, `Declined`, `In Review`, atau `Kyc Expired`; atau tidak
            memiliki hasil dari `model_type` yang diminta (diperiksa sebelum
            file divalidasi). 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 alur kerja atau batas yang hanya berlaku
                    untuk sesi yang disetujui milik kunci dengan cakupan
                    terbatas
                  value:
                    detail: Session not found.
                Not eligible:
                  summary: Sesi belum selesai, atau merupakan ID sesi KYB
                  value:
                    detail: No Session matches the given query.
                No ID verification:
                  summary: model_type=kyc pada sesi tanpa Verifikasi Identitas
                  value:
                    detail: The session does not have KYC data.
                No Proof of Address:
                  summary: model_type=poa pada sesi tanpa Bukti Alamat
                  value:
                    detail: The session does not have POA data.
        '429':
          description: >-
            Batas laju terlampaui: 10 permintaan penambahan gambar per menit per
            kunci API (permintaan yang ditolak juga dihitung). Anggaran bersama
            sebesar 300 permintaan penulisan per menit juga berlaku. 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: >-
                      Session add-images rate limit exceeded. You can make up to
                      10 requests per minute.
          headers:
            Retry-After:
              description: Detik untuk menunggu sebelum mencoba lagi.
              schema:
                type: integer
                minimum: 1
                example: 30
        '503':
          $ref: '#/components/responses/DocumentProcessingBusy'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/add-images/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -F 'file=@./back-of-id.jpg' \
              -F 'model_type=kyc'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.add_images(
                "11111111-2222-3333-4444-555555555555",
                file=open("image.jpg", "rb"),
                model_type="kyc",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: >-
            import Didit, { fileFromPath } from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const result = await
            didit.sessions.addImages("11111111-2222-3333-4444-555555555555", {
              file: await fileFromPath("image.jpg"),
              model_type: "kyc",
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.AddImages(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SessionsAddImagesParams{\n\tFile:      didit.FileFromPath(\"image.jpg\"),\n\tModelType: \"kyc\",\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import java.nio.file.Path;

            import me.didit.Didit;

            import me.didit.types.SessionsAddImagesParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().addImages("11111111-2222-3333-4444-555555555555",
            SessionsAddImagesParams.builder()
                    .file(Path.of("image.jpg"))
                    .modelType(SessionsAddImagesParams.ModelType.of("kyc"))
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;

            use Didit\File;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $result =
            $didit->sessions->addImages('11111111-2222-3333-4444-555555555555',
            [
                'file' => File::fromPath('image.jpg'),
                'model_type' => 'kyc',
            ]);

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

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

            result = didit.sessions.add_images(
              "11111111-2222-3333-4444-555555555555",
              file: Pathname("image.jpg"),
              model_type: "kyc"
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await
            client.Sessions.AddImagesAsync("11111111-2222-3333-4444-555555555555",
            new SessionsAddImagesParams

            {
                File = FileUpload.FromPath("image.jpg"),
                ModelType = "kyc",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  responses:
    DocumentProcessingBusy:
      description: >-
        Terlalu banyak dokumen yang sedang diproses saat ini, sehingga unggahan
        ini tidak diproses: tidak ada yang disimpan dan tidak ada percobaan yang
        terpakai. Kirim kembali file yang sama setelah menunggu selama jumlah
        detik yang tercantum dalam `Retry-After`. Lakukan percabangan
        berdasarkan `code`, bukan pada teks pesan.
      headers:
        Retry-After:
          description: >-
            Jumlah detik yang harus ditunggu sebelum mengirimkan permintaan yang
            sama lagi.
          schema:
            type: integer
            example: 10
      content:
        application/json:
          schema:
            type: object
            required:
              - detail
              - code
            properties:
              detail:
                type: string
              code:
                type: string
                enum:
                  - document_processing_busy
          example:
            detail: We are busy processing documents. Please try again in a moment.
            code: document_processing_busy
  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.