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

# مقاييس إثراء الأحداث عبر واجهة برمجة التطبيقات

> يعرض Didit عدادات استيعاب الأحداث وإثراء IP لفترة محددة: معدل إصابة الذاكرة المؤقتة، ونسبة IP الفريدة، وعمليات البحث الجديدة لكل ألف حدث.

موجّه واجهة برمجة تطبيقات الحصول على مقاييس إثراء الأحداث
نسخ الموجّه إلى الحافظة

<pre>
  \`Read the event ingestion and IP-enrichment counters of my Didit application for a period.

  Endpoint:
  GET [https://verification.didit.me/v3/events/enrichment-metrics/?days=30](https://verification.didit.me/v3/events/enrichment-metrics/?days=30)

  Authentication:
  Use the x-api-key header with my Didit API key. A scoped key needs transactions: read.

  Goal:

  * Monitor event volume and confirm that IP enrichment is resolved once per unique address rather than once per event, for a usage dashboard or an alert.

  Behavior:

  * days defaults to 30 and is clamped to 1-365; a non-integer value falls back to 30.
  * The period covers today plus the previous days days, by UTC calendar day.
  * Counters are summed over every lane (server, batch and device).
  * The three ratios are null when their denominator is zero.

  Example call:
  curl -X GET "[https://verification.didit.me/v3/events/enrichment-metrics/?days=30](https://verification.didit.me/v3/events/enrichment-metrics/?days=30)" \
  -H "x-api-key: YOUR\_API\_KEY"

  What to read from the response:

  * events\_ingested - new events stored (replays are not counted).
  * events\_rejected - items rejected inside batch requests (a rejected single-event request is not counted).
  * enrichment\_lookups - events whose public IP address was resolved; enrichment\_cache\_hits - answered from the cache; enrichment\_provider\_calls - needed a fresh resolution.
  * enrichment\_skipped\_low\_value - low-value telemetry whose address was not cached; it never triggers a lookup of its own.
  * unique\_ips\_seen - distinct addresses that needed a fresh resolution.
  * cache\_hit\_rate, unique\_ip\_ratio, provider\_calls\_per\_1k\_events - the ratios.
  * period\_days - the period actually applied.

  Failure modes:

  * 401 - the API key has expired.
  * 403 - missing API key (a wrong, revoked or expired key gets 401), or a scoped key without transactions: read.

  Side effects: none. This is a pure read.

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

الصق في

تعرض Business Console الأرقام نفسها فوق قائمة الأحداث. راجع [إثراء IP](https://docs.didit.me/ar/transaction-monitoring/events.md#إثراء-عنوان-ip) في دليل استيعاب الأحداث لمعرفة السبب في أن القياسات عن بُعد منخفضة القيمة لا تحصل على الإثراء إلا عندما يكون حدث آخر قد حدّد العنوان مسبقاً، و[إثراء IP](https://docs.didit.me/ar/transaction-monitoring/ip-enrichment.md) للاطلاع على الحقول التي يحملها العنوان المُثرى.


## OpenAPI

````yaml ar/openapi-25.json GET /v3/events/enrichment-metrics/
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/events/enrichment-metrics/:
    get:
      tags:
        - Monitoring Events
      summary: الحصول على مقاييس إثراء الأحداث
      description: >-
        إرجاع عدادات استيعاب الأحداث وإثراء عنوان IP لتطبيقك لفترة محددة، مجمّعة
        عبر كل مسار (الخادم والدفعة والجهاز)، حتى تتمكن من مراقبة حجم الأحداث
        والتأكد من تسوية الإثراء مرة واحدة لكل عنوان فريد بدلاً من مرة واحدة لكل
        حدث. تغطي الفترة اليوم بالإضافة إلى الأيام السابقة المحددة بـ `days`،
        محسوبة حسب تاريخ تقويم UTC. تكون النسب الثلاث فارغة (null) عندما يكون
        مقامها صفراً. يحتاج مفتاح API ذو النطاق المحدد إلى `transactions: read`.
        راجع [IP
        enrichment](https://docs.didit.me/ar/transaction-monitoring/events#إثراء-عنوان-ip).
      operationId: get_monitoring_event_enrichment_metrics
      parameters:
        - name: days
          in: query
          required: false
          description: >-
            طول الفترة بالأيام. القيمة الافتراضية هي 30؛ ويتم حصر القيم بين 1
            و365، وفي حال إدخال قيمة ليست عدداً صحيحاً يتم الرجوع إلى 30
            تلقائياً. تُعاد القيمة المطبقة كـ `period_days`.
          schema:
            type: integer
            default: 30
            minimum: 1
            maximum: 365
          example: 30
      responses:
        '200':
          description: العدادات والنسب للفترة.
          content:
            application/json:
              schema:
                type: object
                required:
                  - events_ingested
                  - events_rejected
                  - enrichment_lookups
                  - enrichment_cache_hits
                  - enrichment_provider_calls
                  - enrichment_skipped_low_value
                  - unique_ips_seen
                  - period_days
                  - cache_hit_rate
                  - unique_ip_ratio
                  - provider_calls_per_1k_events
                properties:
                  events_ingested:
                    type: integer
                    description: >-
                      تم تخزين أحداث جديدة. لا يتم احتساب عمليات إعادة التشغيل
                      المتوافقة مع idempotency.
                  events_rejected:
                    type: integer
                    description: >-
                      العناصر المرفوضة داخل طلبات الدفعات (مسارات الخادم
                      والجهاز). لا يتم احتساب طلب الحدث الفردي المرفوض.
                  enrichment_lookups:
                    type: integer
                    description: >-
                      الأحداث التي تم حل عنوان IP العام الخاص بها، سواء من ذاكرة
                      التخزين المؤقت أو حديثاً.
                  enrichment_cache_hits:
                    type: integer
                    description: عمليات البحث التي تمت الإجابة عليها من التخزين المؤقت.
                  enrichment_provider_calls:
                    type: integer
                    description: عمليات البحث التي تطلبت حلاً جديداً للعنوان.
                  enrichment_skipped_low_value:
                    type: integer
                    description: >-
                      أحداث القياس عن بُعد منخفضة القيمة التي لم يكن عنوانها
                      معروفاً بالفعل. وهي لا تؤدي أبداً إلى عملية حلّ جديدة خاصة
                      بها.
                  unique_ips_seen:
                    type: integer
                    description: العناوين التي احتاجت إلى إعادة تحديدها.
                  period_days:
                    type: integer
                    description: قيمة `days` المطبقة بعد التقييد.
                  cache_hit_rate:
                    type: number
                    nullable: true
                    description: >-
                      `enrichment_cache_hits / enrichment_lookups`، مقربة إلى 4
                      منازل عشرية. تكون Null عند عدم وجود عمليات بحث.
                  unique_ip_ratio:
                    type: number
                    nullable: true
                    description: >-
                      `unique_ips_seen / events_ingested`، مقربة إلى 4 أرقام
                      عشرية. تكون Null عند عدم استيعاب أي أحداث.
                  provider_calls_per_1k_events:
                    type: number
                    nullable: true
                    description: >-
                      القرارات الجديدة لكل 1000 حدث تم استيعابه، مقربة إلى
                      منزلتين عشريتين. تكون Null عند عدم استيعاب أي أحداث.
              examples:
                Last 30 days:
                  value:
                    events_ingested: 128450
                    events_rejected: 214
                    enrichment_lookups: 41230
                    enrichment_cache_hits: 40118
                    enrichment_provider_calls: 1112
                    enrichment_skipped_low_value: 74320
                    unique_ips_seen: 1112
                    period_days: 30
                    cache_hit_rate: 0.973
                    unique_ip_ratio: 0.0087
                    provider_calls_per_1k_events: 8.66
                No events yet:
                  value:
                    events_ingested: 0
                    events_rejected: 0
                    enrichment_lookups: 0
                    enrichment_cache_hits: 0
                    enrichment_provider_calls: 0
                    enrichment_skipped_low_value: 0
                    unique_ips_seen: 0
                    period_days: 30
                    cache_hit_rate: null
                    unique_ip_ratio: null
                    provider_calls_per_1k_events: null
        '401':
          description: >-
            انتهت صلاحية مفتاح API محدد النطاق. المفتاح منتهي الصلاحية فقط هو ما
            يتلقى `401`؛ أما المفتاح المفقود أو غير الصالح فيتلقى `403`.
          content:
            application/json:
              examples:
                Expired key:
                  value:
                    detail: This API key has expired.
        '403':
          description: >-
            `x-api-key` مفقود (المفتاح الخاطئ أو الملغى أو منتهي الصلاحية يتلقى
            `401`)، أو مفتاح ذو نطاق محدد يفتقر إلى `transactions: read`، أو
            مفتاح مقتصر على بعض مسارات سير العمل أو على الجلسات المقبولة (مثل
            هذا المفتاح لا يصل أبداً إلى بيانات مراقبة المعاملات)، أو طلب من
            خارج قائمة العناوين المسموح بها للمفتاح.
          content:
            application/json:
              examples:
                Missing or invalid API key:
                  value:
                    detail: You do not have permission to perform this action.
                Scoped key without access:
                  value:
                    detail: This API key has no read access to transactions.
                Key limited to workflows or approved sessions:
                  value:
                    detail: >-
                      This API key only reaches sessions inside its workflow or
                      status limits, so it can't use this endpoint.
                IP not allowed:
                  value:
                    detail: This API key can't be used from this IP address.
        '429':
          description: >-
            تم تجاوز حد المعدل: تتشارك طلبات `GET` رصيداً قدره 600 طلب في
            الدقيقة لكل مفتاح API. انتظر لعدد الثواني المحدد في `Retry-After`،
            ثم أعد المحاولة.
          headers:
            Retry-After:
              description: عدد الثواني الواجب انتظارها قبل إعادة المحاولة.
              schema:
                type: integer
                minimum: 1
                example: 30
          content:
            application/json:
              examples:
                Throttled:
                  value:
                    detail: >-
                      GET request rate limit exceeded. You can make up to 600
                      requests per minute.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X GET
            'https://verification.didit.me/v3/events/enrichment-metrics/?days=30'
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.monitoring_events.retrieve_enrichment_metrics()
            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.monitoringEvents.retrieveEnrichmentMetrics();

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.MonitoringEvents.RetrieveEnrichmentMetrics(ctx, didit.MonitoringEventsRetrieveEnrichmentMetricsParams{})\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.monitoringEvents().retrieveEnrichmentMetrics();
            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->monitoringEvents->retrieveEnrichmentMetrics();
            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            result = didit.monitoring_events.retrieve_enrichment_metrics
            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.MonitoringEvents.RetrieveEnrichmentMetricsAsync();

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  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.