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

# إضافة صور إلى الجلسة عبر API

> أضف صورة أو ملف PDF إضافياً إلى نتيجة التحقق من الهوية أو إثبات العنوان لجلسة KYC منتهية، مثل الوجه الخلفي للمستند، عبر Didit.

إضافة صور إلى موجّه API لجلسة
نسخ الموجّه إلى الحافظة

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

الصق في

الروابط الموقّعة مسبقاً في `extra_files` تنتهي صلاحيتها. استرجع روابط جديدة من [قرار الجلسة](https://docs.didit.me/ar/sessions-api/retrieve-session.md) عندما تحتاج إلى الملفات لاحقًا. لتصحيح البيانات المستخرجة من مستند بدلاً من ذلك، استخدم [تحديث بيانات الجلسة](https://docs.didit.me/ar/sessions-api/update-data.md).


## OpenAPI

````yaml ar/openapi-25.json PATCH /v3/session/{sessionId}/add-images/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: API التحقق من الهوية. قم بالمصادقة باستخدام الرأس x-api-key.
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/session/{sessionId}/add-images/:
    patch:
      tags:
        - Sessions
      summary: إضافة صورة إلى جلسة
      description: >-
        إرفاق صورة إضافية واحدة أو ملف PDF بنتيجة التحقق من الهوية
        (`model_type=kyc`) أو إثبات العنوان (`model_type=poa`) لجلسة التحقق من
        المستخدمين (KYC) مكتملة، مثل الأدلة التي تم جمعها خارج سير العمل. يجب أن
        تكون الجلسة بحالة `Approved` أو `Declined` أو `In Review` أو `Kyc
        Expired` وأن تتضمن النتيجة المحددة بواسطة `model_type`؛ جلسات التحقق من
        الشركات (KYB) غير مدعومة. يضيف كل استدعاء ملفاً واحداً (إلى أحدث نتيجة
        عند تشغيل الخطوة أكثر من مرة)، ويحتفظ بالملفات الحالية ويسجل إدخال
        `FILE_ADDED` في سجل نشاط الجلسة؛ لا يرسل الرفع أي webhook ولا يغير حالة
        الجلسة. يتم ضغط الملف عند الرفع ويتم إرجاعه في `extra_files` ضمن قرار
        الجلسة. هذا الـ endpoint محدود بـ 10 طلبات في الدقيقة لكل مفتاح API.
        يحتاج مفتاح API ذو النطاق المحدد إلى إذن `sessions: write`، وبدون
        `media: read` يتلقى روابط `extra_files` كـ `null`.
      operationId: patch_v3_session_add_images
      parameters:
        - name: sessionId
          in: path
          required: true
          description: >-
            معرّف UUID لجلسة التحقق من المستخدمين (KYC) لإضافة الملف إليها (وهو
            `session_id` المُرجع بواسطة `POST /v3/session/`). يرجع معرّف جلسة
            التحقق من الشركات (KYB) الرمز `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: >-
                    الصورة أو ملف PDF. الامتدادات المسموح بها: `jpg`، و`jpeg`،
                    و`png`، و`webp`، و`tiff`، و`pdf`. بحد أقصى 15 ميغابايت عند
                    الرفع؛ ثم يُضغط الملف ويُرفض برمز `400` إذا ظل حجمه أكبر من
                    2 ميغابايت (2,097,152 بايت). يتم رفض الملفات الفارغة.
                model_type:
                  type: string
                  enum:
                    - kyc
                    - poa
                  description: >-
                    `kyc` يضيف الملف إلى نتيجة التحقق من الهوية، و`poa` إلى
                    نتيجة إثبات العنوان.
                  example: kyc
                file_password:
                  type: string
                  description: >-
                    كلمة مرور ملف PDF مشفر. بدونها، أو عند إدخال كلمة مرور
                    خاطئة، يُرجع ملف PDF المشفر الرمز `400`.
            example:
              file: (binary)
              model_type: kyc
      responses:
        '200':
          description: >-
            تمت إضافة الملف. يُرجع كل الملفات الإضافية لتلك النتيجة، بما في ذلك
            الملف الجديد.
          content:
            application/json:
              schema:
                type: object
                required:
                  - extra_files
                properties:
                  extra_files:
                    type: array
                    description: >-
                      روابط موقعة مسبقاً قصيرة الأجل لجميع الملفات الإضافية
                      للنتيجة المحددة بواسطة `model_type`، الأقدم أولاً. كل رابط
                      يكون `null` لمفتاح API ذي نطاق محدد بدون إذن `media:
                      read`. اقرأ روابط جديدة من قرار الجلسة لاحقاً.
                    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: >-
            خطأ في التحقق. تصل أخطاء الحقول على شكل `{"<field>":
            ["<message>"]}`؛ وتصل أخطاء ملفات PDF المشفرة على شكل `{"detail":
            "..."}`.
          content:
            application/json:
              examples:
                Missing file:
                  summary: لا يوجد جزء ملف في النموذج
                  value:
                    file:
                      - No file was submitted.
                Missing model_type:
                  summary: تم إغفال model_type
                  value:
                    model_type:
                      - This field is required.
                Invalid model_type:
                  summary: حقل model_type ليس kyc أو poa
                  value:
                    model_type:
                      - '"passport" is not a valid choice.'
                File too large:
                  summary: يتجاوز حجم الملف المرفوع 15 ميجابايت
                  value:
                    file:
                      - File size should not exceed 15 MB
                Too large after compression:
                  summary: لا يزال الحجم يتجاوز 2 ميغابايت بعد الضغط
                  value:
                    file:
                      - File size is too big. Max allowed size is 2097152 bytes.
                Encrypted PDF:
                  summary: ملف PDF مشفر بدون file_password
                  value:
                    detail: >-
                      The PDF is encrypted. Please upload a decrypted PDF or a
                      photo instead.
                Wrong PDF password:
                  summary: file_password لا يفتح ملف PDF
                  value:
                    detail: >-
                      The PDF password is incorrect. Please provide the correct
                      password.
        '401':
          description: >-
            انتهت صلاحية مفتاح API محدد النطاق. هذه هي الحالة الوحيدة التي تُرجع
            `401`: بينما يُرجع المفتاح المفقود أو غير الصالح أو الملغى الرمز
            `403`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              examples:
                Expired key:
                  summary: انقضى تاريخ الانتهاء للمفتاح
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            فشل في المصادقة أو التفويض. يؤدي المفتاح المفقود إلى إرجاع `403`،
            وكذلك المفتاح التابع لتطبيق آخر، أو المفتاح محدد النطاق الذي يفتقر
            إلى الإذن الذي يتطلبه هذا endpoint، أو الطلب الوارد من خارج قائمة IP
            المسموح بها للمفتاح؛ بينما يؤدي المفتاح الخاطئ أو الملغى أو منتهي
            الصلاحية إلى إرجاع `401`. يمكنك التمييز بينها من خلال `detail`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              examples:
                Missing or invalid credentials:
                  summary: لا يوجد رأس x-api-key، أو فشل التحقق من صحة المفتاح
                  value:
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                Other application:
                  summary: مفتاح صالح ينتمي إلى تطبيق مختلف عن الجلسة
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without sessions write:
                  summary: 'المفتاح محدد النطاق يفتقر إلى sessions: write'
                  value:
                    detail: This API key has no write access to sessions.
                IP not allowed:
                  summary: الطلب وارد من خارج قائمة IP المسموح بها للمفتاح
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: >-
            الجلسة غير موجودة، أو تم حذفها، أو أنها خارج حدود مفتاح ذي نطاق
            محدد؛ أو أنها جلسة KYB أو ليست في إحدى الحالات `Approved` أو
            `Declined` أو `In Review` أو `Kyc Expired`؛ أو ليس لديها نتيجة لنوع
            `model_type` المطلوب (يتم التحقق قبل التحقق من صحة الملف). يتم البحث
            عن الجلسة قبل التحقق من بيانات الاعتماد، لذلك فإن معرّف `sessionId`
            غير المعروف يُعيد `404` حتى بدون مفتاح صالح.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              examples:
                Unknown session:
                  summary: لا توجد جلسة بهذا المعرّف، أو أنها حُذفت
                  value:
                    detail: Not found.
                Outside key limits:
                  summary: >-
                    الجلسة خارج سير العمل أو حدود المقبولة فقط الخاصة بمفتاح ذي
                    نطاق محدد
                  value:
                    detail: Session not found.
                Not eligible:
                  summary: لم تكتمل الجلسة بعد، أو معرّف جلسة KYB
                  value:
                    detail: No Session matches the given query.
                No ID verification:
                  summary: تم تعيين model_type=kyc في جلسة لا تتضمن التحقق من الهوية
                  value:
                    detail: The session does not have KYC data.
                No Proof of Address:
                  summary: تم تعيين model_type=poa في جلسة لا تتضمن إثبات العنوان
                  value:
                    detail: The session does not have POA data.
        '429':
          description: >-
            تم تجاوز حد المعدل: 10 طلبات إضافة صور في الدقيقة لكل مفتاح API
            (تُحتسب الطلبات المرفوضة أيضاً). تنطبق أيضاً الميزانية المشتركة
            البالغة 300 طلب كتابة في الدقيقة. انتظر عدد الثواني المحدد في
            `Retry-After` قبل إعادة المحاولة؛ تُظهر رؤوس `X-RateLimit-*`
            الميزانية.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              examples:
                Rate limited:
                  summary: استُنفدت الميزانية المخصصة للدقيقة الحالية
                  value:
                    detail: >-
                      Session add-images rate limit exceeded. You can make up to
                      10 requests per minute.
          headers:
            Retry-After:
              description: عدد الثواني الواجب انتظارها قبل إعادة المحاولة.
              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: >-
        تجري معالجة عدد كبير جداً من المستندات في الوقت الحالي، لذا لم تتم
        معالجة عملية الرفع هذه: لم يتم تخزين أي شيء ولم تُستهلك أي محاولة. أعد
        إرسال الملف نفسه بعد انقضاء عدد الثواني المحدد في `Retry-After`. اعتمد
        في التفريع البرمجي على `code`، وليس على نص الرسالة.
      headers:
        Retry-After:
          description: عدد الثواني للانتظار قبل إرسال الطلب نفسه مرة أخرى.
          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: >-
        مفتاح API الخاص بتطبيقك، من Developers -> API keys في Business Console.
        يمتلك المفتاح الأساسي وصولاً كاملاً. يمكن تحديد نطاق المفتاح المسمى: لا
        شيء، أو قراءة، أو كتابة لكل مورد، ومحدوداً ببعض مسارات العمل أو بالجلسات
        المقبولة، وبقائمة من عناوين IP، وبتاريخ انتهاء الصلاحية. يشير 401 إلى أن
        المفتاح غير صحيح أو ملغى أو منتهي الصلاحية؛ ويشير 403 إلى أنه لم يتم
        إرسال أي مفتاح، أو أن المفتاح ليس لديه حق الوصول إلى هذا المورد أو
        الإجراء، أو أن الطلب جاء من عنوان خارج قائمة عناوين IP الخاصة به؛ ويشير
        404 في مسار جلسة إلى أن الجلسة خارج مسارات العمل أو الحالات الخاصة
        بالمفتاح. يتلقى المفتاح الذي لا يمتلك حق الوصول إلى الوسائط عناوين URL
        للصور ومقاطع الفيديو وملفات PDF كـ null، ويتلقى المفتاح الذي لا يمتلك
        إذن كتابة للجلسات روابط الجلسة وtoken كـ null. راجع
        https://docs.didit.me/console/api-keys.

````

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