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

# رفع مستندات KYB عبر API

> ارفع المستندات المؤسسية إلى جلسة التحقق من الشركات من خادمك، مع الاستفادة من التعرف الضوئي على الحروف والفحوصات المعتمدة في Didit.



## OpenAPI

````yaml ar/openapi-25.json POST /v3/session/{sessionId}/kyb/documents/
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}/kyb/documents/:
    post:
      tags:
        - Sessions
      summary: رفع مستندات KYB إلى جلسة
      description: >-
        رفع مستند شركة أو أكثر (عقد التأسيس، سجل المساهمين، شهادة التأسيس، ...)
        إلى خطوة مستندات KYB في جلسة التحقق من الشركات (KYB)، من خادمك الخاص
        بدلاً من الصفحة المستضافة. تُشغّل Didit مسار المعالجة المستضاف: الضغط،
        وOCR، وفحوصات التلاعب والمطابقة بين المستندات، وتجميع المستندات، مع
        تقديم الجلسة عند استيفاء مجموعات المستندات المطلوبة. تكلفة هذه الخطوة
        رسوم ثابتة واحدة بصرف النظر عن عدد الملفات المرسلة. يجب أن تكون الجلسة
        مفتوحة وضمن خطوة مستندات KYB، كما يجب أن تكون الشركة المختارة في خطوة
        السجل موجودة بالفعل. يمكنك الاطلاع على الأشخاص المذكورين في المستندات
        عبر `GET /v3/session/{sessionId}/kyb/extracted-parties/`. يتطلب
        `write:businesses`.
      operationId: post_v3_session_kyb_documents
      parameters:
        - name: sessionId
          in: path
          required: true
          description: >-
            معرّف UUID لجلسة التحقق من الشركات (KYB). يجب أن تنتمي إلى التطبيق
            الخاص بمفتاح API.
          schema:
            type: string
            format: uuid
            example: 33333333-4444-5555-6666-777777777777
        - name: node_id
          in: query
          required: false
          description: >-
            عقدة سير العمل الخاصة بخطوة KYB. لازمة فقط عندما يحتوي سير العمل على
            أكثر من عقدة KYB واحدة؛ افتراضياً، تستخدم Didit عقدة الجلسة نفسها.
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - documents
              properties:
                documents:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: >-
                    الملفات المطلوب رفعها: JPG، أو JPEG، أو PNG، أو TIFF، أو
                    WEBP، أو PDF أو أرشيفات ZIP منها. ملفات PDF حتى 50 MB،
                    والصور حتى 6 MB قبل الضغط.
                document_passwords:
                  type: array
                  items:
                    type: string
                  description: >-
                    إدخال واحد لكل ملف في `documents`، وبنفس الترتيب: كلمة مرور
                    ملف PDF المحمي، ويكون فارغاً لأي ملف آخر.
                document_group:
                  type: string
                  enum:
                    - LEGAL_PRESENCE
                    - COMPANY_DETAILS
                    - OWNERSHIP_STRUCTURE
                    - REPRESENTATIVES_AUTHORIZATION
                  description: مجموعة المستندات المطلوبة التي يستجيب لها هذا الرفع.
                locale:
                  type: string
                  maxLength: 10
                  description: اللغة المستخدمة لترجمة استجابة الخطوة التالية.
      responses:
        '200':
          description: >-
            تمت معالجة المستندات. عندما يتم استيفاء كل مجموعة مطلوبة تتقدم
            الجلسة ويُحدد `next_step` الخطوة التالية؛ بخلاف ذلك تظل في خطوة
            المستندات وتوضح `document_groups` و`document_answer` ما لا يزال
            مفقوداً.
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                  next_step:
                    type: string
                    nullable: true
                    description: الخطوة التي توجد بها الجلسة بعد الرفع.
                  kyb_status:
                    type: string
                    description: حالة فحص الشركة.
                  document_answer:
                    type: object
                    additionalProperties: true
                    description: النتيجة لكل مستند تم رفعه وعمليات الرفع المتبقية.
                additionalProperties: true
              example:
                valid: true
                next_step: KYB_KEY_PEOPLE
                kyb_status: In Progress
        '400':
          description: >-
            تم رفض مستند (بسبب التلاعب، أو عدم القابلية للقراءة، أو عدم دعمه) أو
            أن الجلسة لا تحتوي على شركة KYB بعد. أعد المحاولة بملف آخر طالما
            تبقت محاولات.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              example:
                message: No KYB company found. Submit company data first.
        '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.
        '402':
          description: لم يتبقَّ لدى المؤسسة أي رصيد لخطوة المستندات.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              example:
                detail: Insufficient credits.
        '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 decisions write:
                  summary: 'المفتاح محدد النطاق يفتقر إلى decisions: write'
                  value:
                    detail: This API key has no write access to decisions.
                IP not allowed:
                  summary: الطلب وارد من خارج قائمة IP المسموح بها للمفتاح
                  value:
                    detail: This API key can't be used from this IP address.
        '404':
          description: >-
            الجلسة غير موجودة، أو تم حذفها، أو تنتمي إلى تطبيق آخر، أو أنها خارج
            حدود مفتاح ذي نطاق محدد؛ لا توجد تفاصيل تميز بين هذه الحالات.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              example:
                detail: Session not found.
        '409':
          description: >-
            الجلسة مكتملة (`kyb_session_not_writable`) أو ليست في خطوة مستندات
            KYB (`kyb_step_mismatch`، مع تحديد اسم الخطوة الحالية في
            `next_step`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
                  code:
                    type: string
                  next_step:
                    type: string
              example:
                detail: The session is not on the step this operation completes.
                code: kyb_step_mismatch
                next_step: KYB_REGISTRY
        '429':
          description: >-
            تم تجاوز حد المعدل: 300 طلب كتابة (POST وPATCH وDELETE) في الدقيقة
            لكل مفتاح API. انتظر عدد الثواني المحدد في `Retry-After` قبل إعادة
            المحاولة؛ تُظهر رؤوس `X-RateLimit-*` الميزانية.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: رسالة خطأ سهلة القراءة.
              examples:
                Rate limited:
                  summary: استُنفدت الميزانية المخصصة للدقيقة الحالية
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
          headers:
            Retry-After:
              description: عدد الثواني الواجب انتظارها قبل إعادة المحاولة.
              schema:
                type: integer
                minimum: 1
                example: 30
        '503':
          $ref: '#/components/responses/DocumentProcessingBusy'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.upload_kyb_documents(
                "33333333-4444-5555-6666-777777777777",
                documents=[open("document.pdf", "rb")],
            )
            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.uploadKybDocuments("33333333-4444-5555-6666-777777777777",
            {
              documents: [await fileFromPath("document.pdf")],
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.UploadKYBDocuments(ctx, \"33333333-4444-5555-6666-777777777777\", didit.SessionsUploadKYBDocumentsParams{\n\tDocuments: []didit.File{didit.FileFromPath(\"document.pdf\")},\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 java.util.List;

            import me.didit.Didit;

            import me.didit.types.SessionsUploadKybDocumentsParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().uploadKybDocuments("33333333-4444-5555-6666-777777777777",
            SessionsUploadKybDocumentsParams.builder()
                    .documents(List.of(Path.of("document.pdf")))
                    .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->uploadKybDocuments('33333333-4444-5555-6666-777777777777',
            [
                'documents' => [File::fromPath('document.pdf')],
            ]);

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

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

            result = didit.sessions.upload_kyb_documents(
              "33333333-4444-5555-6666-777777777777",
              documents: [Pathname("document.pdf")]
            )
            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.UploadKybDocumentsAsync("33333333-4444-5555-6666-777777777777",
            new SessionsUploadKybDocumentsParams

            {
                Documents = new FileUpload[] { FileUpload.FromPath("document.pdf") },
            });

            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.