> ## 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: الموافقة والمزامنة والحسابات

> يعيد مسار Didit للحصول على اتصال بنكي اتصالاً واحداً مع حالته وتواريخ الموافقة وحالة المزامنة وملخصات الحسابات وتكلفته.

يعيد نقطة النهاية «الحصول على اتصال بنكي» في Didit اتصالاً بنكياً واحداً مع حالته وتواريخ الموافقة وحالة المزامنة وملخصات الحسابات والتكلفة.
يخبرك `sync.initial_status` بالوقت الذي تصبح فيه أولى البيانات قابلة للقراءة، و`consent.expires_at` بالوقت الذي يجب فيه التجديد، و`sync.budgets` بعدد مرات التحديث التي لا يزال البنك يسمح بها.
راجع [الاتصالات](https://docs.didit.me/ar/core-technology/bank-verification/connections.md).


## OpenAPI

````yaml ar/openapi-25.json GET /v3/bank/connections/{id}/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: واجهة برمجة تطبيقات التحقق من الهوية. صادِق باستخدام الترويسة x-api-key.
servers:
  - url: https://verification.didit.me
security: []
tags:
  - name: Bank Data
    description: >-
      Bank Link والاتصالات والحسابات والأرصدة والمعاملات والمؤسسات والتغطية.
      بيانات البنك متاحة للتطبيقات التجريبية. ترد استدعاءات التطبيق الحي بـ
      `404` إلى أن يُعلن الوصول الحي. لا تُحتسب أي رسوم في البيئة التجريبية.
      يحتاج الاستدعاء الذي يتم بمفتاح API إلى مفتاح يتضمن إذن بيانات البنك
      (`bank-data`): القراءة للقراءات، والكتابة للعمليات التي تغيّر شيئاً. فحص
      الحساب هو الاستثناء: يحتاج إلى صلاحية الكتابة على الجلسات، أو الوصول
      الكامل، وليس إذن بيانات البنك. بيانات البنك غير مشمولة بالوصول الكامل:
      يُرفض مفتاح الوصول الكامل، ويرد الاستدعاء بـ `403 bank_data_access_denied`
      إلى أن تنشئ مفتاحاً يتضمن الإذن. ترفض بيانات البنك الخام (الحسابات
      والأرصدة والمعاملات وموجز التغييرات) أيضاً الطلب الذي لا يتضمن مفتاح API.


      تحمل كل حالات الرفض ضمن `/v3/bank/`، باستثناء رفض فحص الحساب، جسم JSON
      نفسه (`code`، `message`، `request_id`، `field`، `next_action`،
      `retry_after`). يرد مسار ليس عملية، أو معرّف ليس UUID، أو مورد فرعي غير
      معروف، بـ `404 not_found` لكل طريقة، ويرد أي خطأ غير متوقع بـ `500
      internal_error` مع `request_id`. حيثما لا تكون بيانات البنك متاحة، ترد كل
      عملية بـ `404` القياسي للمنصة، تماماً كما يرد المسار غير المعروف.
paths:
  /v3/bank/connections/{id}/:
    get:
      tags:
        - Bank Data
      summary: الحصول على اتصال بنكي
      description: >-
        تُرجع الاتصال مع موافقته وحالة المزامنة وملخصًا لكل حساب. اقرأ البيانات
        نفسها بعمليات الحسابات والأرصدة والمعاملات. يظهر الاتصال المحذوف كسجل
        مختصر: معرّفه و`status: deleted` والسبب وتواريخه وحالة `erasure` الخاصة
        به، دون أي حسابات أو أرصدة أو معاملات أو بيانات موافقة أو مزامنة.


        يحتاج إلى مفتاح API يملك إذن بيانات البنك (`bank-data`): قراءة لهذه
        العملية. لا يشمل المفتاح ذو الوصول الكامل هذا الإذن، لذا امنحه صراحةً
        عند إنشاء المفتاح، وإلا أجاب الاستدعاء بـ `403 bank_data_access_denied`.
      operationId: getBankConnection
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: معرّف الاتصال.
      responses:
        '200':
          description: الاتصال.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankConnection'
              examples:
                Active ongoing connection:
                  summary: اتصال شركة نشط ومستمر
                  value:
                    id: 5e1d2a70-3b94-4c1f-8a6e-d2f07b9c1e35
                    environment: live
                    access: ongoing
                    status: active
                    status_reason: null
                    institution:
                      id: es-banco-norte
                      name: Banco Norte
                      country: ESP
                      logo_url: https://static.example.com/banks/es-banco-norte.png
                    segment: business
                    data:
                      - accounts
                      - balances
                      - transactions
                    consent:
                      status: granted
                      version: 1
                      granted_at: '2026-11-21T12:04:11Z'
                      expires_at: '2027-05-20T12:04:11Z'
                      days_granted: 180
                      renewed_count: 0
                      scopes_requested:
                        - accounts
                        - balances
                        - transactions
                      scopes_granted:
                        - accounts
                        - balances
                        - transactions
                      accounts_granted:
                        - a71f0c2e-5d38-4b96-a1c4-3e9f8d2b7a10
                        - c3d84e19-2a7b-4f60-b5e1-9a0c6d3f8e72
                      renewal_action: bank_auth
                      renew_by: '2027-05-20T12:04:11Z'
                      reconfirm_by: null
                      renewable_until: null
                      retain_until: null
                      ended_at: null
                      ended_by: null
                    sync:
                      status: ok
                      initial_status: succeeded
                      initial_complete: true
                      history_complete: true
                      last_synced_at: '2026-11-21T12:04:40Z'
                      next_sync_at: '2026-11-22T06:00:00Z'
                      budgets:
                        - scope: connection
                          resource: all
                          limit: 4
                          remaining: 3
                          resets_at: '2026-11-22T00:00:00Z'
                      last_error: null
                      frequency_per_day: 1
                      live_syncs_left_today: 3
                    accounts:
                      - id: a71f0c2e-5d38-4b96-a1c4-3e9f8d2b7a10
                        name: Cuenta negocio
                        type: current
                        usage: business
                        currency: EUR
                        iban_last4: '1332'
                        status: open
                      - id: c3d84e19-2a7b-4f60-b5e1-9a0c6d3f8e72
                        name: Cuenta de ahorro
                        type: savings
                        usage: business
                        currency: EUR
                        iban_last4: '7708'
                        status: open
                    ownership:
                      compare: none
                      match: null
                      check_id: null
                      result: null
                    end_user:
                      reference: client-7731
                    manage_url: null
                    billing:
                      unit: connection_month
                      price_usd: '0.9000'
                      billed_through: '2026-11-30'
                    possible_duplicate_of: null
                    erasure: null
                    vendor_data: client-7731
                    created_at: '2026-11-21T12:03:02Z'
                    updated_at: '2026-11-21T12:04:40Z'
                Renewal required:
                  summary: >-
                    انتهت الموافقة؛ تبقى البيانات قابلة للقراءة كما كانت عند آخر
                    مزامنة
                  value:
                    id: 5e1d2a70-3b94-4c1f-8a6e-d2f07b9c1e35
                    environment: live
                    access: ongoing
                    status: renewal_required
                    status_reason: consent_expired
                    institution:
                      id: es-banco-norte
                      name: Banco Norte
                      country: ESP
                      logo_url: https://static.example.com/banks/es-banco-norte.png
                    segment: business
                    data:
                      - accounts
                      - balances
                      - transactions
                    consent:
                      status: expired
                      version: 1
                      granted_at: '2026-11-21T12:04:11Z'
                      expires_at: '2027-05-20T12:04:11Z'
                      days_granted: 180
                      renewed_count: 0
                      scopes_requested:
                        - accounts
                        - balances
                        - transactions
                      scopes_granted:
                        - accounts
                        - balances
                        - transactions
                      accounts_granted:
                        - a71f0c2e-5d38-4b96-a1c4-3e9f8d2b7a10
                        - c3d84e19-2a7b-4f60-b5e1-9a0c6d3f8e72
                      renewal_action: bank_auth
                      renew_by: '2027-05-20T12:04:11Z'
                      reconfirm_by: null
                      renewable_until: '2027-06-19T12:04:11Z'
                      retain_until: '2027-06-19T12:04:11Z'
                      ended_at: '2027-05-20T12:04:11Z'
                      ended_by: bank
                    sync:
                      status: ok
                      initial_status: succeeded
                      initial_complete: true
                      history_complete: true
                      last_synced_at: '2026-11-21T12:04:40Z'
                      next_sync_at: '2026-11-22T06:00:00Z'
                      budgets:
                        - scope: connection
                          resource: all
                          limit: 4
                          remaining: 3
                          resets_at: '2026-11-22T00:00:00Z'
                      last_error: null
                      frequency_per_day: 1
                      live_syncs_left_today: 3
                    accounts:
                      - id: a71f0c2e-5d38-4b96-a1c4-3e9f8d2b7a10
                        name: Cuenta negocio
                        type: current
                        usage: business
                        currency: EUR
                        iban_last4: '1332'
                        status: open
                      - id: c3d84e19-2a7b-4f60-b5e1-9a0c6d3f8e72
                        name: Cuenta de ahorro
                        type: savings
                        usage: business
                        currency: EUR
                        iban_last4: '7708'
                        status: open
                    ownership:
                      compare: none
                      match: null
                      check_id: null
                      result: null
                    end_user:
                      reference: client-7731
                    manage_url: null
                    billing:
                      unit: connection_month
                      price_usd: '0.9000'
                      billed_through: '2026-11-30'
                    possible_duplicate_of: null
                    erasure: null
                    vendor_data: client-7731
                    created_at: '2026-11-21T12:03:02Z'
                    updated_at: '2026-11-21T12:04:40Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/BankDataAccessDenied'
        '404':
          description: المورد غير موجود في هذا التطبيق وهذه البيئة.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankDataError'
              examples:
                Not found:
                  summary: غير موجود
                  value:
                    code: not_found
                    message: The resource does not exist.
                    request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                    field: null
                    next_action: null
                    retry_after: null
        '429':
          $ref: '#/components/responses/RateLimitedRead'
        '500':
          $ref: '#/components/responses/BankDataInternalError'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl
            'https://verification.didit.me/v3/bank/connections/5e1d2a70-3b94-4c1f-8a6e-d2f07b9c1e35/'
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.bank.get_connection(
                "11111111-2222-3333-4444-555555555555",
            )
            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.bank.getConnection("11111111-2222-3333-4444-555555555555");

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Bank.GetConnection(ctx, \"11111111-2222-3333-4444-555555555555\")\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import me.didit.Didit;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.bank().getConnection("11111111-2222-3333-4444-555555555555");

            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->bank->getConnection('11111111-2222-3333-4444-555555555555');

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


            # Reads DIDIT_API_KEY.

            didit = Didit::Client.new


            result =
            didit.bank.get_connection("11111111-2222-3333-4444-555555555555")

            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.Bank.GetConnectionAsync("11111111-2222-3333-4444-555555555555");

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    BankConnection:
      type: object
      description: >-
        إذن الشخص لتطبيقك بقراءة بنك واحد. تحافظ عملية التجديد على معرّف الربط
        ومعرّف كل حساب. يتضمّن الربط المحذوف الحقول `id` و`status`
        و`status_reason` و`created_at` و`erasure` فقط، ولا تظهر فيه أي حقول
        أخرى، ولا تبقى فيه أي بيانات عن البنك أو الشخص أو الحسابات.
      properties:
        id:
          type: string
          description: معرّف الاتصال.
          format: uuid
        environment:
          type: string
          enum:
            - live
            - sandbox
        access:
          type: string
          enum:
            - one_time
            - ongoing
        status:
          type: string
          enum:
            - pending
            - active
            - renewal_required
            - paused
            - revoked
            - deleted
            - failed
          description: >-
            `pending`: المزامنة الأولى قيد التشغيل. `active`: الموافقة سارية.
            `renewal_required`: انتهت الموافقة أو يطلب البنك من الشخص تسجيل
            الدخول مجددًا، والبيانات قابلة للقراءة كما في آخر مزامنة ولا يُحتسب
            أي مبلغ. `paused`: الرصيد منخفض للشهر. `revoked`: أوقف الشخص أو
            البنك أو أنت الوصول. `deleted`: لا يبقى سوى `id` و`status`
            و`status_reason` و`created_at` و`erasure`. `failed`: لم تنجح
            المزامنة الأولى قط.
        status_reason:
          type: string
          enum:
            - collection_complete
            - consent_expired
            - consent_lapsed
            - bank_requires_sign_in
            - revoked_by_end_user
            - revoked_by_bank
            - revoked_by_customer
            - insufficient_balance
            - paused_by_customer
            - first_sync_failed
            - deleted_by_customer
            - retention_elapsed
            - application_deleted
            - null
          description: >-
            سبب وجود الاتصال بهذه الحالة. الحالة `paused_by_customer` محجوزة. في
            الاتصال ذي الحالة `deleted`: `deleted_by_customer` أو
            `consent_lapsed` أو `retention_elapsed` أو `application_deleted`.
          nullable: true
        institution:
          $ref: '#/components/schemas/BankInstitutionSummary'
        segment:
          type: string
          enum:
            - personal
            - business
            - null
          nullable: true
        data:
          type: array
          items:
            type: string
            enum:
              - accounts
              - balances
              - transactions
          description: النطاقات التي وافق عليها الشخص.
        consent:
          $ref: '#/components/schemas/BankConnectionConsent'
        sync:
          $ref: '#/components/schemas/BankConnectionSync'
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/BankConnectionAccountSummary'
          description: ملخص لكل حساب في الاتصال. اقرأ الحساب كاملا باستخدام `get_account`.
        ownership:
          $ref: '#/components/schemas/BankConnectionOwnership'
        end_user:
          type: object
          properties:
            reference:
              type: string
              description: معرّفك للشخص أو الشركة.
              nullable: true
          required:
            - reference
        manage_url:
          type: string
          description: >-
            صفحة الوصول الخاصة بالشخص. تكون القيمة `null` إلى أن تصبح صفحة
            الوصول متاحة.
          nullable: true
          format: uri
        billing:
          $ref: '#/components/schemas/BankConnectionBilling'
        possible_duplicate_of:
          type: string
          description: >-
            يُضبط عندما قد يكون هذا الاتصال مكرراً لاتصال نشط آخر، ولم يسمح أي
            `end_user.reference` بتطابق مؤكد.
          format: uuid
          nullable: true
        erasure:
          allOf:
            - $ref: '#/components/schemas/BankConnectionErasure'
          nullable: true
          description: يُضبط بعد `delete_connection`، وإلا فهو `null`.
        vendor_data:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - status
        - status_reason
        - created_at
        - erasure
    BankDataError:
      type: object
      description: جسم الخطأ لكل عملية من عمليات بيانات البنك. جميع الحقول موجودة دائماً.
      properties:
        code:
          type: string
          enum:
            - ongoing_access_not_available
            - segment_not_available
            - window_not_available
            - history_window_ambiguous
            - redirect_url_not_registered
            - link_origin_not_allowed
            - bank_data_access_denied
            - connection_not_active
            - consent_expired
            - renewal_not_needed
            - renewal_window_expired
            - access_removed
            - refresh_limit_reached
            - cursor_expired
            - page_expired
            - invalid_cursor
            - page_token_mismatch
            - contract_rate_missing
            - insufficient_credits
            - invalid_request
            - not_found
            - internal_error
          description: >-
            رمز الخطأ بصيغة يمكن للآلة قراءتها. اعتمد على هذا الرمز في التفريع،
            ولا تعتمد على `message` أبداً.
        message:
          type: string
          description: شرح بلغة بسيطة للمطوّر. قد تتغير الصياغة؛ لا تحلّلها برمجياً.
        request_id:
          type: string
          description: معرّف هذا الطلب. اذكره عند التواصل مع الدعم.
        field:
          type: string
          description: >-
            حقل الطلب المطلوب تصحيحه، إذا كان الخطأ متعلقاً بحقل واحد. وإلا
            فتكون القيمة `null`.
          nullable: true
        next_action:
          type: string
          enum:
            - retry_later
            - renew_connection
            - create_link
            - restart_from_cursor
            - restart_read
            - top_up_balance
            - enable_bank_data_access
            - contact_support
            - null
          description: >-
            ما الذي ينبغي فعله تاليًا، حتى يتمكن العميل من التصرف دون تخمين.
            القيمة `null` عندما لا توجد خطوة تالية قياسية.
          nullable: true
        retry_after:
          type: integer
          description: >-
            عدد الثواني التي تنتظرها قبل إعادة المحاولة. يُضبط عند أخطاء حد
            المعدل والأخطاء المؤقتة، وإلا فهو `null`.
          nullable: true
      required:
        - code
        - message
        - request_id
        - field
        - next_action
        - retry_after
      example:
        code: ongoing_access_not_available
        message: >-
          This bank cannot keep access open. Use access one_time or choose
          another bank.
        request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
        field: institution_id
        next_action: create_link
        retry_after: null
    BankInstitutionSummary:
      type: object
      description: المصرف المرتبط به الاتصال أو الرابط.
      properties:
        id:
          type: string
          description: >-
            معرّف Didit للبنك، وهو معرّف نصي ثابت. استخدمه بوصفه
            `institution_id`.
          example: es-banco-norte
        name:
          type: string
          description: اسم المصرف.
          example: Banco Norte
        country:
          type: string
          description: دولة البنك، بصيغة ISO 3166-1 alpha-3.
          pattern: ^[A-Z]{3}$
          example: ESP
        logo_url:
          type: string
          description: شعار البنك، أو `null`.
          nullable: true
          format: uri
      required:
        - id
        - name
        - country
        - logo_url
    BankConnectionConsent:
      type: object
      description: موافقة الشخص على هذا الربط.
      properties:
        status:
          type: string
          enum:
            - granted
            - expired
            - revocation_pending
            - revoked
            - revocation_failed
          description: >-
            `revocation_pending` حتى يؤكد البنك إنهاء الموافقة، ثم `revoked`.
            تُعاد محاولة `revocation_failed` تلقائياً. تتوقف عمليات جلب البيانات
            من البنك فور طلب الإلغاء.
        version:
          type: integer
          description: إصدار الموافقة. تُنشئ عملية التجديد الإصدار التالي على الربط نفسه.
        granted_at:
          type: string
          format: date-time
          nullable: true
        expires_at:
          type: string
          description: متى تنتهي موافقة البنك. يحددها البنك، بحد أقصى `consent_days`.
          format: date-time
          nullable: true
        days_granted:
          type: integer
          description: مدة الموافقة بالأيام، كما منحها البنك.
          nullable: true
        renewed_count:
          type: integer
          description: عدد مرات تجديد الموافقة.
        scopes_requested:
          type: array
          items:
            type: string
            enum:
              - accounts
              - balances
              - transactions
        scopes_granted:
          type: array
          items:
            type: string
            enum:
              - accounts
              - balances
              - transactions
        accounts_granted:
          type: array
          items:
            type: string
            format: uuid
          description: معرّفات الحسابات التي يشاركها الشخص.
        renewal_action:
          type: string
          enum:
            - reconfirm
            - bank_auth
            - null
          description: >-
            كيفية تجديد الموافقة: `reconfirm` هو أن يؤكد الشخص على شاشة Didit
            دون تسجيل دخول إلى البنك، حيثما يسمح البنك وتسمح قواعد البلد بذلك.
            و`bank_auth` هو تسجيل دخول إلى البنك.
          nullable: true
        renew_by:
          type: string
          description: 'موعد انتهاء الموافقة: جدّدها قبله لتفادي أي انقطاع.'
          format: date-time
          nullable: true
        reconfirm_by:
          type: string
          description: >-
            يُضبط عندما يكون `renewal_action` مساوياً لـ `reconfirm`: آخر لحظة
            لتأكيد الاتصال.
          format: date-time
          nullable: true
        renewable_until:
          type: string
          description: >-
            آخر لحظة يمكن فيها إعادة تفعيل الاتصال نفسه بعد انتهاء الموافقة.
            بعدها يتعين على الشخص الاتصال من جديد. وهي تساوي `retain_until`.
          format: date-time
          nullable: true
        retain_until:
          type: string
          description: >-
            يُضبط بعد انتهاء الوصول: المدة التي تبقى فيها البيانات المخزّنة
            قابلة للقراءة، وتحددها إعدادات الاحتفاظ بالبيانات في تطبيقك.
          format: date-time
          nullable: true
        ended_at:
          type: string
          format: date-time
          nullable: true
        ended_by:
          type: string
          enum:
            - end_user
            - bank
            - customer
            - unknown
            - null
          description: >-
            من أنهى الوصول، ويُحدَّد استنادًا إلى الأدلة. القيمة `unknown` عندما
            لا يذكر ذلك البنك ولا المزامنة.
          nullable: true
      required:
        - status
        - version
        - granted_at
        - expires_at
        - days_granted
        - renewed_count
        - scopes_requested
        - scopes_granted
        - accounts_granted
        - renewal_action
        - renew_by
        - reconfirm_by
        - renewable_until
        - retain_until
        - ended_at
        - ended_by
    BankConnectionSync:
      type: object
      description: حالة مزامنة الاتصال.
      properties:
        status:
          type: string
          enum:
            - pending
            - ok
            - failing
          description: >-
            `failing` بعد 24 ساعة من المحاولات الفاشلة، التي تُعاد مع تأجيل
            متزايد. إذا طلب البنك من الشخص تسجيل الدخول مرة أخرى، يصبح الاتصال
            `renewal_required` بدلًا من ذلك.
        initial_status:
          type: string
          enum:
            - pending
            - succeeded
            - partial
            - failed
          description: >-
            نتيجة المزامنة الأولى. يصبح الاتصال `active` عند `succeeded` أو
            `partial`، ويصبح `failed` عندما لا ينجح أي حساب.
        initial_complete:
          type: boolean
          description: >-
            `true` فقط عندما يكون `initial_status` هو `succeeded`: يمكن قراءة
            الحسابات والأرصدة والمعاملات الأخيرة.
        history_complete:
          type: boolean
          description: >-
            `true` عندما ينتهي استكمال السجل التاريخي لأي سبب كان. النطاقات التي
            لم يتمكن من جلبها موجودة في `history_coverage.missing_ranges` لكل
            حساب.
        last_synced_at:
          type: string
          description: متى جُلبت البيانات آخر مرة من البنك، وليس متى قرأتها آخر مرة.
          format: date-time
          nullable: true
        next_sync_at:
          type: string
          description: >-
            متى تُجدوَل المزامنة التلقائية التالية. تعمل المزامنة التلقائية بين
            مرة واحدة وأربع مرات يوميًا بحسب البنك (راجع `frequency_per_day`).
          format: date-time
          nullable: true
        budgets:
          type: array
          items:
            $ref: '#/components/schemas/BankSyncBudget'
          description: حدود المصرف على عمليات الجلب التي تُجرى دون حضور الشخص.
        last_error:
          allOf:
            - $ref: '#/components/schemas/BankSyncError'
          nullable: true
          description: آخر خطأ في المزامنة، أو `null`.
        frequency_per_day:
          type: integer
          minimum: 1
          maximum: 4
          description: >-
            عدد مرات تشغيل المزامنة التلقائية يومياً لهذا الاتصال، بين مرة وأربع
            مرات حسب البنك. وحيثما يسمح البنك بقراءات دون حضور الشخص أكثر، تبقى
            مرتان يومياً على الأقل متاحتين دائماً للمزامنات المباشرة.
        live_syncs_left_today:
          type: integer
          minimum: 0
          description: >-
            عدد عمليات المزامنة المباشرة (`refresh_connection`) المتبقية اليوم
            ضمن حد البنك: قيمة `remaining` للميزانية الأضيق. تعني `null` أن
            البنك لا يحدد حداً. تُدرج المزامنات المباشرة في السعر الشهري.
          nullable: true
      required:
        - status
        - initial_status
        - initial_complete
        - history_complete
        - last_synced_at
        - next_sync_at
        - budgets
        - last_error
        - frequency_per_day
        - live_syncs_left_today
    BankConnectionAccountSummary:
      type: object
      description: شكل مختصر لحساب داخل اتصال.
      properties:
        id:
          type: string
          description: معرّف الحساب. ثابت طوال عمر الاتصال، بما في ذلك عمليات التجديد.
          format: uuid
        name:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - current
            - savings
            - card
            - loan
            - investment
            - other
        usage:
          type: string
          enum:
            - personal
            - business
            - unknown
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          description: رمز العملة وفق ISO 4217.
        iban_last4:
          type: string
          description: آخر أربعة أحرف من رقم IBAN، إن كان للحساب رقم IBAN.
          nullable: true
        status:
          type: string
          enum:
            - open
            - closed
            - access_removed
      required:
        - id
        - name
        - type
        - usage
        - currency
        - iban_last4
        - status
    BankConnectionOwnership:
      type: object
      description: المقارنة الاختيارية لصاحب الحساب مع شخص أو شركة.
      properties:
        compare:
          type: string
          enum:
            - none
            - person
            - business
        match:
          type: string
          enum:
            - any_holder
            - all_holders
            - null
          nullable: true
        check_id:
          type: string
          description: معرّف نتيجة الملكية عند طلب المقارنة.
          format: uuid
          nullable: true
        result:
          type: string
          enum:
            - match
            - close_match
            - no_match
            - unknown
            - null
          description: >-
            الحكم. تكون القيمة `unknown` كلما كان دليل صاحب الحساب الناقص قد
            يغيّره، وعندما لا يشارك البنك صاحب الحساب.
          nullable: true
      required:
        - compare
        - match
        - check_id
        - result
    BankConnectionBilling:
      type: object
      description: ما تكلفة هذا الاتصال. لا تُحتسب أي رسوم على البيئة التجريبية أبدًا.
      properties:
        unit:
          type: string
          description: >-
            وحدة الفوترة، `connection_month` للوصول المستمر، و`one_time` في غير
            ذلك.
          enum:
            - connection_month
            - one_time
        price_usd:
          type: string
          description: >-
            سعرك للشهر الحالي لمقياس الاستخدام، لتطبيقك والدولة، بالدولار
            الأمريكي، كسلسلة عشرية بأربع منازل عشرية. يُحتسب الاتصال عن الشهر
            فقط عندما تكون كل نطاقات الموافقة المقبولة قد نشرت بيانات لحساب واحد
            على الأقل في ذلك الشهر. القيمة `null` للاتصالات لمرة واحدة وفي
            البيئة التجريبية. يُحتسب الوصول المستمر بحسب الاتصال النشط في الشهر،
            والسعر الحالي موجود في صفحة الأسعار
            (https://docs.didit.me/getting-started/pricing). المبالغ في الأمثلة
            توضيحية، ويظهر سعر الدولة في صفحة الأسعار.
          pattern: ^-?\d+(\.\d+)?$
          nullable: true
        billed_through:
          type: string
          description: آخر نهاية شهر تمت تسويتها.
          format: date
          nullable: true
      required:
        - unit
        - price_usd
        - billed_through
    BankConnectionErasure:
      type: object
      description: تقدم عملية الحذف التي طلبتها.
      properties:
        status:
          type: string
          enum:
            - pending
            - erased
            - failed
          description: >-
            `pending` أثناء تنفيذ الحذف، و`erased` عندما لا تبقى أي نسخة مخزنة
            ولا وصول لدى البنك، و`failed` عندما يتعذر تأكيده خلال 24 ساعة. يُبقي
            الحذف الفاشل بيانات الاتصال مغلقة، ويُعاد تنفيذه، ويُنبَّه Didit.
        requested_at:
          type: string
          format: date-time
        erased_at:
          type: string
          format: date-time
          nullable: true
          description: متى انتهى الحذف. القيمة `null` حتى تصبح قيمة `status` هي `erased`.
      required:
        - status
        - requested_at
        - erased_at
    RateLimitBudgetError:
      type: object
      description: >-
        تُرجع فقط عند رفض ميزانية وسيط تحديد المعدل. أخطاء 429 الأخرى، بما في
        ذلك تعارضات idempotency والحدود الخاصة بنقطة النهاية، لا تضمن هذه الحقول
        الوصفية.
      required:
        - detail
        - reference
        - limit
        - remaining
        - reset
        - window_seconds
      properties:
        detail:
          type: string
          description: رسالة رفض الميزانية الحالية المقروءة للإنسان.
        reference:
          type: string
          pattern: ^RL-[0-9a-f]{32}$
          description: >-
            مرجع الدعم المعتم: RL- متبوعة بـ 32 حرفًا سداسيًا عشريًا صغيرًا من
            UUID.
        limit:
          type: integer
          description: الميزانية للنطاق الذي تجاوز الحد؛ تساوي X-RateLimit-Limit.
        remaining:
          type: integer
          minimum: 0
          description: >-
            الميزانية المتبقية، محدودة بحيث لا تقل عن الصفر؛ تساوي
            X-RateLimit-Remaining.
        reset:
          type: integer
          format: int64
          description: >-
            وقت إعادة تعيين النافذة بالثواني منذ حقبة Unix، ويساوي
            X-RateLimit-Reset.
        window_seconds:
          type: integer
          description: >-
            مدة النافذة الثابتة بالثواني، وليست الفترة المتبقية للانتظار. يجب
            احترام Retry-After قبل إعادة المحاولة.
      example:
        detail: >-
          Write request rate limit exceeded. You can make up to 300 requests per
          minute.
        reference: RL-00000000000040008000000000000001
        limit: 300
        remaining: 0
        reset: 1794358860
        window_seconds: 60
    BankSyncBudget:
      type: object
      description: حصة واحدة من حد البنك على عمليات الجلب في غياب الشخص.
      properties:
        scope:
          type: string
          enum:
            - connection
            - account
          description: ما الذي يحتسب البنك الميزانية عليه.
        resource:
          type: string
          enum:
            - all
            - accounts
            - balances
            - transactions
        account_id:
          type: string
          description: الحساب، عندما تكون `scope` بقيمة `account`.
          format: uuid
          nullable: true
        limit:
          type: integer
          description: >-
            عدد المرات اليومية التي يحق فيها لـ Didit جلب البيانات من البنك دون
            حضور الشخص، وفق تعريف البنك. هذا سقف يحدده البنك، وليس وعداً.
        remaining:
          type: integer
          description: >-
            عدد عمليات التحديث المتاحة لك في النافذة الحالية. عمليات القراءة
            المخصّصة للمزامنات التلقائية مخصومة مسبقاً، ولا تستهلك المزامنة
            التلقائية آخر قراءتين في اليوم، لذا يبقى دائماً تحديثان عند الطلب
            متاحين.
        resets_at:
          type: string
          description: متى تُعاد تهيئة النافذة الزمنية.
          format: date-time
      required:
        - scope
        - resource
        - limit
        - remaining
        - resets_at
    BankSyncError:
      type: object
      description: سبب فشل المزامنة.
      properties:
        code:
          type: string
          description: رمز خطأ Didit.
        message:
          type: string
          description: شرح بلغة بسيطة.
        at:
          type: string
          description: متى حدث. القيمة `null` في نتيجة الحساب الفردية.
          format: date-time
          nullable: true
      required:
        - code
        - message
        - at
  responses:
    Unauthorized:
      description: غير مُصرَّح به
      content:
        application/json:
          examples:
            Invalid API Key:
              summary: مفتاح API غير صالح
              value:
                detail: Invalid API Key.
    BankDataAccessDenied:
      description: >-
        لا يملك مفتاح API صلاحية بيانات البنك (`bank-data`)، أو، بالنسبة
        للبيانات الخام في تطبيق إنتاجي، يكون الإعداد "Bank data in the API"
        متوقفا. بيانات البنك ليست جزءا من الوصول الكامل: يُرفض بهذا النص مفتاح
        الوصول الكامل، ومفتاح مقيّد بموارد أخرى، وطلب مصادق عليه دون مفتاح API
        (بيانات اعتماد العميل عند طلب البيانات الخام)، لذا أنشئ مفتاحا وامنحه
        الصلاحية صراحة. يحدث الرفض قبل أي بحث، لذا لا يدل على وجود الكائن أو
        عدمه.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BankDataError'
          examples:
            Bank data not allowed:
              summary: بيانات البنك غير مسموح بها
              value:
                code: bank_data_access_denied
                message: >-
                  Bank data calls need an API key that carries the Bank data
                  permission.
                request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                field: null
                next_action: enable_bank_data_access
                retry_after: null
    RateLimitedRead:
      description: >-
        تجاوزت ميزانية القراءة الخاصة بالوسيط. التزم بالرأس Retry-After قبل
        إعادة المحاولة.
      headers:
        Retry-After:
          $ref: '#/components/headers/BudgetRetryAfter'
        X-RateLimit-Scope:
          $ref: '#/components/headers/BudgetXRateLimitScope'
        X-RateLimit-Limit:
          $ref: '#/components/headers/BudgetXRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/BudgetXRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/BudgetXRateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitBudgetError'
          example:
            detail: >-
              GET request rate limit exceeded. You can make up to 600 requests
              per minute.
            reference: RL-00000000000040008000000000000001
            limit: 600
            remaining: 0
            reset: 1794358860
            window_seconds: 60
    BankDataInternalError:
      description: >-
        حدث خطأ من جهة Didit. أي خطأ غير متوقع تحت `/v3/bank/` يُعاد بصيغة خطأ
        Bank، وليس بصفحة HTML أبداً: أرفق `request_id` عند التواصل مع الدعم.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BankDataError'
          examples:
            Internal error:
              summary: خطأ غير متوقع
              value:
                code: internal_error
                message: >-
                  Something went wrong on our side. Quote the request_id to
                  support.
                request_id: 3f6a1c8e92b54d07a1e38c4b7f0d2e59
                field: null
                next_action: contact_support
                retry_after: null
  headers:
    BudgetRetryAfter:
      description: >-
        عدد الثواني للانتظار، مقرّباً إلى أعلى حتى بداية النافذة التالية. يظهر
        في حالات رفض ميزانية الوسيط.
      schema:
        type: integer
    BudgetXRateLimitScope:
      description: النطاق الذي تجاوز ميزانيته. يظهر في حالات رفض ميزانية الوسيط.
      schema:
        type: string
    BudgetXRateLimitLimit:
      description: >-
        الميزانية المخصصة للنطاق الذي تم تجاوزه؛ وتساوي حد جسم الطلب. تظهر في
        حالات الرفض الصادرة عن ميزانية البرمجية الوسيطة.
      schema:
        type: integer
    BudgetXRateLimitRemaining:
      description: >-
        الميزانية المتبقية، محدودة بحيث لا تقل عن الصفر؛ تساوي remaining في
        الجسم. تظهر في حالات رفض الميزانية من الوسيط.
      schema:
        type: integer
    BudgetXRateLimitReset:
      description: >-
        وقت إعادة التعيين بالثواني منذ حقبة Unix؛ يساوي قيمة reset في جسم
        الاستجابة. يظهر في حالات رفض ميزانية الوسيط.
      schema:
        type: integer
  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، ويتلقى المفتاح الذي لا
        يملك صلاحية كتابة الجلسات روابط الجلسات والرموز بقيمة null. راجع
        https://docs.didit.me/console/api-keys.

````

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