> ## 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: الحق في النسيان بموجب GDPR

> احذف جلسة KYC أو KYB وجميع بياناتها عبر Didit. تُحذف تضمينات الوجه افتراضياً، والتطبيقات المفعّلة يمكنها الاحتفاظ بقالب بيومتري بلا صور.



موجّه حذف الجلسة
        نسخ الموجّه إلى الحافظة



      
      

\<pre>

\`Delete a single Didit verification session and all of its data, and control what happens to the face biometric data.

Endpoint:
DELETE https://verification.didit.me/v3/session/{session_id}/delete/

Authentication:
Use the x-api-key header with your Didit API key. Privilege: delete:sessions.

Path parameter:
\- session_id (UUID) — works for both User Verification (KYC) and Business Verification (KYB) sessions. Didit resolves the id against both session types.

Optional JSON body (send Content-Type: application/json; omit the body entirely for the default behavior):
\- retain_face_embeddings (boolean | null) — override the application's face_retention_policy for this deletion. true keeps an image-free biometric template anchored to the session's User; false deletes the face embedding with the session; omit or null to follow the application policy.
\- face_retention_days (integer 1-3650) — finite retention duration for the template. Required when retaining unless the application already sets face_retention_days.
\- face_retention_deadline (ISO 8601 datetime, future) — optional hard expiry. The template expires at the earliest of face_retention_days, the application's data-retention window, and this deadline.
\- deletion_instruction ("operational_session_delete" default | "privacy_erasure") — privacy_erasure purges every retained biometric template for the session's User and never retains a new one, regardless of the application policy. Combining privacy_erasure with retain_face_embeddings: true is rejected with 400.
\- instruction_id (string, max 255) — your own durable reference for this deletion instruction (for example your erasure-ticket id). Stored on the audit trail and on any retained template.

curl examples:
Default (follow the application policy; delete_with_session unless you opted in):
curl -X DELETE https://verification.didit.me/v3/session/<SESSION_ID>/delete/ \
-H "x-api-key: <API_KEY>"

Delete the session but keep an image-free biometric template for 365 days:
curl -X DELETE https://verification.didit.me/v3/session/<SESSION_ID>/delete/ \
-H "x-api-key: <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"retain_face_embeddings": true, "face_retention_days": 365}'

Right-to-erasure request (delete the session AND purge every retained template for that person):
curl -X DELETE https://verification.didit.me/v3/session/<SESSION_ID>/delete/ \
-H "x-api-key: <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"deletion_instruction": "privacy_erasure", "instruction_id": "dsar-2026-0142"}'

Response: 200 OK with a JSON body once the deletion has completed (this endpoint no longer returns 204):
\{
"session_id": "<uuid>",
"session_number": 1024,
"face_retention_outcome": "deleted" | "retained_with_user" | "none" | "ineligible_no_vendor_user",
"biometric_template_uuid": "<uuid>" | null,
"biometric_template_expires_at": "<ISO 8601 datetime>" | null,
"deleted_child_verifications": 0
}
\- deleted: the session and its face embedding are deleted (default behavior).
\- retained_with_user: the session is deleted; an image-free biometric template with the returned biometric_template_uuid stays anchored to the User until biometric_template_expires_at, User deletion, privacy erasure, or explicit purge. Manage it with GET/DELETE /v3/biometric-templates/{uuid}/.
\- none: the session had no face embedding (for example a KYB session or a document-only KYC session).
\- ineligible_no_vendor_user: retention was requested but the session has no linked User (no vendor_data), so nothing can anchor the template. The session and its embedding are deleted.
\- biometric_template_expires_at: when the retained template is deleted; null when no template is retained.
\- deleted_child_verifications: for a KYB session, how many verifications it created (its key people's KYC sessions and its corporate owners' KYB sessions, recursively) were deleted with it. Always 0 for a KYC session.

Behavior:
\- The session and every verification attempt it holds are deleted, including results a resubmission replaced: the decision, the extracted data, the associated feature records (ID verification, registry checks, documents, AML, IP, etc.), its reviews and activity log, and all stored files (document images, videos, portraits, selfies, POA documents, extra uploads, and E-signature documents, signed PDFs, evidence PDFs and signature images).
\- A KYB session is deleted together with the verifications it created for its key people and corporate owners. A verification it only links to (for example a reused, already approved KYC) is not deleted.
\- The session disappears immediately from /v3/sessions/ and /v3/session/{id}/decision/, and media URLs issued before the call stop resolving.
\- Webhook deliveries still queued for the session, and their retries, are dropped. Webhooks already delivered are not affected.
\- Ongoing AML monitoring and KYB registry monitoring started by the deleted verifications stop.
\- A retained biometric template never contains the face image, liveness video, document data, extracted identity fields, the decision, or the deleted session's id. It is biometric data, tenant-scoped, used only for your duplicate-face, multi-account, biometric-authentication, and list matching, and it is never used for model training or cross-customer fraud processing.
\- Share tokens issued for the session are NOT revoked, but there is nothing left for them to import: an import with one returns 400 {"share_token": ["Original session does not exist."]}.
\- Blocklist entries created from the session are NOT removed; manage those with the Lists endpoints.
\- Credits already consumed by the verification are NOT refunded.
\- The parent User or Business entity is NOT deleted; use POST /v3/users/delete/ or POST /v3/businesses/delete/ for those. Deleting the User also purges its retained biometric templates. If the User's profile portrait came from this session, the portrait is removed.
\- No webhook fires for the deletion itself.

Idempotency:
Idempotent in effect: the second call to the same session returns 404 because the session no longer exists. Deletion is permanent and cannot be undone.

Failure modes:
\- 400: {"retain_face_embeddings": ["Privacy erasure cannot retain biometric templates."]} or {"detail": "A finite biometric-template retention duration is required."} (retention requested without face_retention_days on the request or the application). Nothing is deleted.
\- 403: {"detail": "You do not have permission to perform this action."} when the key lacks delete:sessions.
\- 404: {"detail": "Not found."} when the session does not exist (or was already deleted).
\- 409: {"detail": "...", "code": "in_filed_report", "reports": [{"uuid": "...", "report_number": "SAR-0001", "report_type": "SAR", "case_uuid": "..."}]} when the session is part of a finalized regulatory report. Nothing is deleted. Delete the reports, then repeat the request.
\- 503: {"detail": "The session could not be deleted because a storage service or a monitoring provider is unavailable. The session is still in place; repeat the request to finish deleting it."} or {"detail": "The biometric-template operation could not finish because an external store is unavailable. The operation is retryable."} The session is still in place; repeat the same request until it returns 200. Some of its stored files or its face embedding may already be deleted. Retries converge on a single template.

Bulk delete:
For many KYC sessions at once, use POST /v3/sessions/delete/ with body {"session_numbers": ["1001", "1002"]} or {"delete_all": true}; it accepts the same retention and instruction fields. Up to 20 matching sessions return 200 with a per-session outcome; more return 202 with a job to poll at GET /v3/sessions/delete/{job_id}/.

Migration note:
Until this release the endpoint returned 204 No Content. It now returns 200 OK with the JSON body above. Update clients that assert on 204. The default deletion behavior is unchanged: existing applications stay on delete_with_session until you explicitly change the policy.

When to call:
\- Customer requests data erasure (GDPR Article 17): use deletion_instruction: "privacy_erasure".
\- Operational clean-up after approval while keeping duplicate detection: retain_face_embeddings: true with a finite face_retention_days.
\- Cleaning up test sessions from a staging application.
\- After exporting a decision PDF for long-term archival outside Didit.

For end-to-end Didit integration, paste in the full prompt at /integration/integration-prompt.`

\</pre>



      
      

الصق في

## الدعم لـ KYC وKYBيعمل هذا الإجراء مع جلسات **التحقق من المستخدم (KYC)** وجلسات **التحقق من الشركات (KYB)**. يُحلّ `session_id` مقابل النوعين، وينطبق سلوك الحذف نفسه على كليهما. لا ينطبق الاحتفاظ بالقالب البيومتري إلا على جلسات KYC، لأن جلسات KYC وحدها تحتوي على تضمين الوجه.## السلوك- تُحذف الجلسة مع كل محاولات التحقق التي تتضمنها، بما في ذلك النتائج التي استبدلتها إعادة الإرسال. يشمل ذلك قرارها، وبياناتها المستخرجة، وسجلات الميزات المرتبطة بها (التحقق من الهوية، وفحوصات السجلات، والمستندات، وAML، وتحليل عنوان IP، وغيرها)، ومراجعاتها وسجل نشاطها، وجميع ملفاتها المخزّنة.
- يؤدي حذف جلسة **التحقق من الشركات (KYB)** أيضاً إلى حذف التحققات التي أنشأتها للأشخاص الرئيسيين (KYC) ولمالكيها من الشركات (KYB)، بشكل تكراري. تُبلغ الاستجابة عن عددها في `deleted_child_verifications`. لا يُحذف التحقق الذي تربط به الجلسة فقط، مثل KYC موجود ومعتمد أعادت استخدامه.
- تُحذف معه بيانات التوقيع الإلكتروني: المستندات المطلوب توقيعها وملفات Word الأصلية الخاصة بها، وملفات PDF الموقّعة، وملفات PDF الخاصة بالأدلة، وصور التوقيع، وكل قيم الحقول. تُعيد مسارات التنزيل الخاصة بها `404`.
- تختفي الجلسة من استجابات القائمة والقرار فوراً، وتتوقف عن العمل روابط الوسائط الصادرة قبل الاستدعاء.
- تُسقط عمليات تسليم webhook المنتظرة للجلسة، وكذلك إعادة المحاولات الخاصة بها.
- تتوقف مراقبة AML المستمرة ومراقبة سجل الشركات (KYB) اللتان بدأتهما التحققات المحذوفة.
- الحذف نهائي ولا يمكن التراجع عنه. لا يوجد endpoint للاستعادة، لذا صدّر أي شيء تحتاجه، مثل ملف PDF للقرار، قبل أن تستدعي هذا الإجراء.
- الاستجابة هي `200 OK`، وتُرسل بعد اكتمال الحذف، مع جسم JSON يوضح ما حدث لبيانات الوجه البيومترية للجلسة. راجع [الترحيل](#الترحيل-من-استجابات-204) إذا كان عميلك ما زال يتوقع `204`.## البيانات في تقرير تنظيمي نهائيإذا كانت الجلسة جزءاً من حالة لها تقرير تنظيمي نهائي، يُرجع الطلب `409` ولا يُحذف أي شيء. تستخدم الاستجابة `code: in_filed_report` وتسمّي كل تقرير:```json theme={null}
{
  "detail": "This session is part of a finalized regulatory report, so it cannot be deleted.",
  "code": "in_filed_report",
  "reports": [
    {
      "uuid": "5ec00000-0000-4000-8000-000000000007",
      "report_number": "SAR-0001",
      "report_type": "SAR",
      "case_uuid": "c1a5e000-0000-4000-8000-000000000001"
    }
  ]
}
```احذف كل تقرير باستخدام [حذف التقرير](https://docs.didit.me/ar/management-api/regulatory-reports/delete.md)، ثم كرر عملية الحذف. حذف التقرير لا يحذف الجلسة، وتبقى الجلسة حتى تستدعي هذا الـendpoint مرة أخرى.## البيانات البيومترية للوجه: الحذف أو الاحتفاظتحتوي كل جلسة KYC تتضمن صورة سيلفي لكشف الحيوية على تضمين للوجه يُستخدم في [البحث بالوجه 1:N](https://docs.didit.me/ar/core-technology/face-search/overview.md) واكتشاف التكرار. وبشكل افتراضي يُحذف هذا التضمين مع الجلسة (`face_retention_policy: delete_with_session`)، لذلك يمكن للشخص الذي حذفتَ جلسته أن يتحقق من هويته مرة أخرى دون أن يُعلَّم على أنه مكرر.يمكن للتطبيقات التي تحتاج إلى أن يستمر اكتشاف التكرار بعد حذف الجلسة أن تفعّل **الاحتفاظ بالقالب البيومتري**. عندئذٍ يحذف Didit الجلسة وجميع بياناتها كالمعتاد، ويحتفظ بقالب بيومتري منفصل للوجه خالٍ من الصور ومرتبط [بالمستخدم](https://docs.didit.me/ar/entities/users/overview.md) الذي تنتمي إليه الجلسة.> [!WARNING]
>
> القالب البيومتري المحفوظ بيانات بيومترية. وهو ليس مجهول الهوية، وليس مؤقتاً، ولا يُحذف مع الجلسة. يبقى حتى انتهاء صلاحيته المجدولة، أو حلول موعد نهائي يفرضه القانون المعمول به قبل ذلك، أو حذف المستخدم، أو طلب محو البيانات للخصوصية، أو الحذف الصريح. فعّل الاحتفاظ فقط عندما تغطيه تعليمات المتحكم وإشعار الخصوصية لديك.ما يحتويه القالب المحفوظ وما لا يحتويه:| محفوظ | غير محفوظ أبداً |
| - | - |
| القالب الرقمي للوجه المستخدم في المطابقة | صورة الوجه، وفيديو الاختبار الحيوي، وصور المستندات، وقصاصات الصور الشخصية، وأي وسائط أخرى |
| معرّف عشوائي جديد للقالب و`provenance_reference` غير شفاف | معرّف الجلسة المحذوفة أو رقمها أو قرارها أو حقول الهوية المستخرجة أو حمولات payload الخاصة بالميزات |
| المستخدم المالك (`vendor_user_uuid` و`vendor_data` الحالية) | حالة قائمة الحظر، والمطابقات السابقة، وتصنيفات الاحتيال، وادعاءات الهوية عبر المؤسسات |
| بيانات الاحتفاظ الوصفية: `retained_at` و`expires_at` والسياسة والتجاوز وفئة التعليمات و`instruction_id` ومعرّف الجهة المنفذة | عناوين البريد الإلكتروني للجهات الفاعلة |يتم ضبط الاحتفاظ في ثلاثة أماكن، من الأعم إلى الأخص:1) **سياسة التطبيق** في **Business Console ← إعدادات التطبيق ← الاحتفاظ بالبيانات**، أو عبر `PATCH /v3/webhook/` (`face_retention_policy`، `face_retention_days`). انظر [الاحتفاظ بالبيانات](https://docs.didit.me/ar/console/data-retention.md#الاحتفاظ-بالقالب-البيومتري).
2) **التجاوز لكل استدعاء** عبر `retain_face_embeddings` في هذا الendpoint وفي [حذف الجلسات دفعة واحدة](https://docs.didit.me/ar/management-api/sessions/batch-delete.md).
3) **فئة التعليمات** عبر `deletion_instruction`. تعليمات `privacy_erasure` تتغلب دائماً: فهي تحذف كل قالب محفوظ لهذا المستخدم ولا تحفظ أي قالب جديد.### نص الطلبجميع الحقول اختيارية. لا تُرسل نص الطلب لاتباع سياسة التطبيق.| الحقل | النوع | الوصف |
| - | - | - |
| `retain_face_embeddings` | قيمة منطقية أو null | تجاوز سياسة التطبيق لهذا الحذف. تؤدي `true` إلى حفظ قالب، و`false` إلى حذف التضمين مع الجلسة، و`null` أو الحقل المُغفَل يتبعان السياسة. |
| `face_retention_days` | عدد صحيح (1-3650) | مدة احتفاظ محددة للقالب. مطلوبة عند حفظ قالب ما لم يكن التطبيق يضبط `face_retention_days` بالفعل. |
| `face_retention_deadline` | التاريخ والوقت (ISO 8601) | حد انتهاء صارم اختياري. يجب أن يكون في المستقبل. |
| `deletion_instruction` | `operational_session_delete` (الافتراضي) أو `privacy_erasure` | فئة التعليمات التي تعطيها. تحذف `privacy_erasure` كل قالب محفوظ لمستخدم الجلسة قبل حذف الجلسة، ولا يمكن دمجها مع `retain_face_embeddings: true`. |
| `instruction_id` | نص (بحد أقصى 255) | مرجعك الدائم لهذه التعليمة، مثل معرّف تذكرة المحو لديك. يُسجَّل في سجل التدقيق وفي أي قالب محفوظ. وإن أغفلته يُنشئ Didit معرّفاً ويمكنك قراءته في تفاصيل القالب. |### الاستجابة```json theme={null}
{
  "session_id": "4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02",
  "session_number": 1024,
  "face_retention_outcome": "retained_with_user",
  "biometric_template_uuid": "9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b",
  "biometric_template_expires_at": "2027-10-09T10:15:00Z",
  "deleted_child_verifications": 0
}
```| الحقل | الوصف |
| - | - |
| `session_id` | الجلسة المحذوفة. |
| `session_number` | رقم الجلسة المحذوفة. |
| `face_retention_outcome` | ما حدث للبيانات البيومترية للوجه في الجلسة. انظر الجدول أدناه. |
| `biometric_template_uuid` | معرّف القالب البيومتري المحفوظ عندما تكون قيمة `face_retention_outcome` هي `retained_with_user`، وإلا فهو `null`. |
| `biometric_template_expires_at` | موعد حذف القالب البيومتري المحفوظ؛ ويكون `null` عندما لا يُحفظ أي قالب. |
| `deleted_child_verifications` | بالنسبة إلى جلسة KYB، عدد عمليات التحقق التي أنشأتها (جلسات KYC لأشخاصها الرئيسيين وجلسات KYB لمالكيها من الشركات، بشكل متكرر) وقد حُذفت معها. تكون دائماً `0` لجلسة KYC. || `face_retention_outcome` | المعنى |
| - | - |
| `deleted` | حُذفت الجلسة وتضمين الوجه الخاص بها. هذا هو السلوك الافتراضي. |
| `retained_with_user` | حُذفت الجلسة. يبقى قالب بيومتري واحد خالٍ من الصور مرتبطاً بالمستخدم، ومعرّفه هو `biometric_template_uuid`. أدِره عبر [واجهة Biometric Templates API](https://docs.didit.me/ar/management-api/biometric-templates/overview.md). |
| `none` | لم يكن لدى الجلسة تضمين للوجه لحذفه أو حفظه (مثل جلسة KYB، أو جلسة KYC بلا صورة سيلفي لكشف الحيوية). |
| `ineligible_no_vendor_user` | طُلب الاحتفاظ، لكن الجلسة غير مرتبطة بمستخدم (أُنشئت بدون `vendor_data`)، فلا يوجد ما يمكن أن يرتبط به القالب. تُحذف الجلسة وتضمينها. تُسجَّل حالة عدم الأهلية في سجل التدقيق. |تؤكد الاستجابة أن Didit قبل تعليمة الحذف الخاصة بك وطبّقها. وهي ليست شهادة محو: احتفظ بـ`instruction_id` في سجل المحو لديك حتى تتمكن من مطابقته مع سجل التدقيق لاحقاً.### مدة الاحتفاظ وانتهاؤهلكل قالب محفوظ `expires_at` محدد. يضبطه Didit على أقرب الخيارات التالية:1) `face_retention_days` من الطلب، أو `face_retention_days` الخاصة بالتطبيق عندما يُغفلها الطلب؛
2) نافذة الاحتفاظ العامة بالبيانات لدى التطبيق، عندما تكون مضبوطة؛
3) `face_retention_deadline` من الطلب، عندما يُرسل.يُرفض الطلب الذي يحفظ قالباً دون أي مدة محددة بالاستجابة `400`، ولا يُحذف شيء. لا يمكن أن تتجاوز القوالب المحفوظة أقرب تعليمة مطبَّقة من العميل، أو انتهاء الغرض، أو الانتهاء المضبوط، أو تعليمة محو بيانات صاحب البيانات، أو المهلة القانونية للبيانات البيومترية. أنت مسؤول عن اختيار مدة تفي بالقوانين المنطبقة على مستخدميك، واختر مدة أقصر كلما كانت قاعدة منطبقة تقتضي ذلك.### محو البيانات لأغراض الخصوصيةأرسل `deletion_instruction: "privacy_erasure"` عندما تتصرف بناءً على طلب من صاحب البيانات. تحذف Didit كل قالب بيومتري محتفظ به مرتبط بـ**مستخدم** الجلسة، ثم تحذف الجلسة وتضمينها. لا يمكن لسياسة الاحتفاظ بالبيانات في التطبيق أن تتجاوز تعليمة الحذف بدافع الخصوصية، ويُرفض `retain_face_embeddings: true` مع الاستجابة `400`.حذف المستخدم باستخدام [حذف المستخدمين دفعةً واحدة](https://docs.didit.me/ar/management-api/users/delete.md) يُفرّغ أيضاً القوالب المحتفظ بها الخاصة به.## ما الذي لا يتأثرحذف الجلسة لا ينظّف هذه البيانات تلقائياً. إذا كنت تتعامل مع طلب محو بموجب حق المحو، فعالجها بشكل منفصل.- **إدخالات قائمة الحظر** المنشأة من الجلسة (الوجه أو المستند) تبقى في مكانها. أزلها من [قائمة الحظر](https://docs.didit.me/ar/entities/users/blocklist.md). يحتفظ إدخال الوجه في قائمة الحظر بإدخاله البيومتري الخاص، وهو مستقل عن أي قالب محتفظ به.
- **رموز المشاركة** الصادرة للجلسة لا تُلغى، لكن لم يعد هناك ما تستورده: [الاستيراد](https://docs.didit.me/ar/sessions-api/share-session/import.md) باستخدامها يُرجع `400` مع `{"share_token": ["Original session does not exist."]}`.
- **webhook التي سُلّمت بالفعل** للجلسة لا تتأثر. التسليمات التي ما زالت في قائمة الانتظار، ومحاولات إعادتها، تُسقط. لا يُرسل أي webhook للحذف نفسه.
- **الأرصدة المستهلكة** في عملية التحقق لا تُسترد.
- **النسخ الموقعة التي أُرسلت بالفعل بالبريد الإلكتروني** إلى الموقّع عبر خطوة **التوقيع الإلكتروني** موجودة في صندوق بريد الموقّع ولا تتأثر.
- لا يُحذف الكيان الأب **مستخدم** أو **شركة**. استخدم [حذف المستخدمين](https://docs.didit.me/ar/management-api/users/delete.md) أو [حذف الشركات](https://docs.didit.me/ar/management-api/businesses/delete.md) لحذفهما. إذا كانت صورة الملف الشخصي للمستخدم قد جاءت من الجلسة المحذوفة، فستُزال الصورة.
- **القالب البيومتري المحتفظ به** (فقط عند اختيار الاحتفاظ) يبقى حتى تنتهي صلاحيته أو تمسحه. امسحه عبر [Biometric Templates API](https://docs.didit.me/ar/management-api/biometric-templates/purge.md)، أو بحذف المستخدم، أو بتكرار حذف جلسة أخرى للمستخدم نفسه مع `deletion_instruction: "privacy_erasure"`.## أمثلة> [tab] الافتراضي (سياسة التطبيق)
>
> ```bash theme={null}
> curl -X DELETE https://verification.didit.me/v3/session/4c5c7f3a-.../delete/ \
>   -H "x-api-key: YOUR_API_KEY"
> ```
>
> الاستجابة في تطبيق لم يختر تفعيل الاحتفاظ:
>
> ```json theme={null}
> {
>   "session_id": "4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02",
>   "session_number": 1024,
>   "face_retention_outcome": "deleted",
>   "biometric_template_uuid": null,
>   "biometric_template_expires_at": null,
>   "deleted_child_verifications": 0
> }
> ```> [tab] الاحتفاظ بقالب بيومتري
>
> ```bash theme={null}
> curl -X DELETE https://verification.didit.me/v3/session/4c5c7f3a-.../delete/ \
>   -H "x-api-key: YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"retain_face_embeddings": true, "face_retention_days": 365, "instruction_id": "cleanup-2026-08-0142"}'
> ```
>
> ```json theme={null}
> {
>   "session_id": "4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02",
>   "session_number": 1024,
>   "face_retention_outcome": "retained_with_user",
>   "biometric_template_uuid": "9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b",
>   "biometric_template_expires_at": "2027-10-09T10:15:00Z",
>   "deleted_child_verifications": 0
> }
> ```> [tab] فرض الحذف في تطبيق اختار تفعيل الاحتفاظ
>
> ```bash theme={null}
> curl -X DELETE https://verification.didit.me/v3/session/4c5c7f3a-.../delete/ \
>   -H "x-api-key: YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"retain_face_embeddings": false}'
> ```
>
> ```json theme={null}
> {
>   "session_id": "4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02",
>   "session_number": 1024,
>   "face_retention_outcome": "deleted",
>   "biometric_template_uuid": null,
>   "biometric_template_expires_at": null,
>   "deleted_child_verifications": 0
> }
> ```> [tab] محو البيانات لأغراض الخصوصية
>
> ```bash theme={null}
> curl -X DELETE https://verification.didit.me/v3/session/4c5c7f3a-.../delete/ \
>   -H "x-api-key: YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"deletion_instruction": "privacy_erasure", "instruction_id": "dsar-2026-0142"}'
> ```
>
> تُمسح أولاً كل القوالب المحتفظ بها لـ**مستخدم** الجلسة، ثم تُحذف الجلسة:
>
> ```json theme={null}
> {
>   "session_id": "4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02",
>   "session_number": 1024,
>   "face_retention_outcome": "deleted",
>   "biometric_template_uuid": null,
>   "biometric_template_expires_at": null,
>   "deleted_child_verifications": 0
> }
> ```> [tab] جلسة بدون مستخدم
>
> جلسة أُنشئت بدون `vendor_data` لا يوجد لها مستخدم لربط قالب به:
>
> ```bash theme={null}
> curl -X DELETE https://verification.didit.me/v3/session/7a1e9c2d-.../delete/ \
>   -H "x-api-key: YOUR_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{"retain_face_embeddings": true, "face_retention_days": 365}'
> ```
>
> ```json theme={null}
> {
>   "session_id": "7a1e9c2d-5f4b-4c3a-8e2d-1b0a9f8e7d6c",
>   "session_number": 1031,
>   "face_retention_outcome": "ineligible_no_vendor_user",
>   "biometric_template_uuid": null,
>   "biometric_template_expires_at": null,
>   "deleted_child_verifications": 0
> }
> ```> [tab] جلسة التحقق من الشركات (KYB)
>
> ```bash theme={null}
> curl -X DELETE https://verification.didit.me/v3/session/bs-01HJX1.../delete/ \
>   -H "x-api-key: YOUR_API_KEY"
> ```
>
> يُحذف التحقق من الشركات مع التحققات الثلاثة التي أنشأها لأشخاصه الرئيسيين:
>
> ```json theme={null}
> {
>   "session_id": "0f3c9b7e-2d1a-4e5f-8c6b-7a9d8e1f2c3b",
>   "session_number": 88,
>   "face_retention_outcome": "none",
>   "biometric_template_uuid": null,
>   "biometric_template_expires_at": null,
>   "deleted_child_verifications": 3
> }
> ```## الأخطاء| الحالة | متى | المحتوى |
| - | - | - |
| `400` | `privacy_erasure` مع `retain_face_embeddings: true` | `{"retain_face_embeddings": ["Privacy erasure cannot retain biometric templates."]}` |
| `400` | طلب الاحتفاظ دون مدة محدودة في الطلب أو في التطبيق | `{"detail": "A finite biometric-template retention duration is required."}` |
| `403` | بيانات الاعتماد لا تملك `delete:sessions` أو لا تملك الجلسة | `{"detail": "You do not have permission to perform this action."}` |
| `404` | جلسة غير معروفة أو محذوفة مسبقاً | `{"detail": "Not found."}` |
| `503` | كانت إحدى خدمات التخزين أو مزود المراقبة غير متاحة أثناء حذف الجلسة. | `{"detail": "The session could not be deleted because a storage service or a monitoring provider is unavailable. The session is still in place; repeat the request to finish deleting it."}` |
| `503` | كان مخزن بيومتري غير متاحًا أثناء الاحتفاظ بقالب أو مسحه. تضمن إعادة المحاولة وجود قالب واحد فقط. | `{"detail": "The biometric-template operation could not finish because an external store is unavailable. The operation is retryable."}` |عند `400` لا يُحذف شيء. عند `503` تبقى الجلسة في مكانها: أعد الطلب نفسه حتى يُرجع `200`. قد تكون بعض ملفاتها المخزنة أو تضمين وجهها قد حُذف بالفعل، فلا تعتمد عليها بعد `503`.## الإذنيتطلب `delete:sessions`. الإذن نفسه يغطي جلسات التحقق من المستخدمين (KYC) وجلسات التحقق من الشركات (KYB)، وتجاوز سياسة الاحتفاظ.## الحذف الجماعيللعمليات الجماعية على جلسات KYC، استخدم `POST /v3/sessions/delete/`. تقبل الطلب الحقول نفسها الخاصة بالاحتفاظ والتعليمات. تُحذف حتى 20 جلسة مطابقة داخل الطلب مع نتيجة لكل جلسة، ويُنفَّذ الباقي كـ[مهمة حذف](https://docs.didit.me/ar/management-api/sessions/get-deletion-job.md). انظر [حذف الجلسات دفعةً واحدة](https://docs.didit.me/ar/management-api/sessions/batch-delete.md).## الترحيل من استجابات 204حتى هذا الإصدار كانت نقطة النهاية تُرجع `204 No Content`. تُرجع الآن `200 OK` مع جسم JSON الموثق أعلاه، حتى يتضمن كل حذف قيمة `face_retention_outcome` الخاصة به. حدّث العملاء الذين يتحققون من `204`.السلوك الافتراضي لم يتغير: تبقى التطبيقات الحالية على `delete_with_session`، ولا يفعّل أي ترحيل الاحتفاظ نيابةً عنك. فعّله صراحةً من وحدة التحكم أو عبر `PATCH /v3/webhook/`.## ذات صلة- [القوالب البيومترية](https://docs.didit.me/ar/management-api/biometric-templates/overview.md)
- [الاحتفاظ بالبيانات](https://docs.didit.me/ar/console/data-retention.md)
- [نظرة عامة على الجلسات](https://docs.didit.me/ar/sessions-api/overview.md)


## OpenAPI

````yaml ar/openapi-25.json DELETE /v3/session/{sessionId}/delete/
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}/delete/:
    delete:
      tags:
        - Sessions
      summary: حذف جلسة تحقق (KYC أو KYB)
      description: >-
        حذف جلسة تحقق واحدة، سواء كانت جلسة التحقق من المستخدمين (KYC) أو جلسة
        التحقق من الشركات (KYB)، باستخدام `session_id` الخاص بها. يتم التحقق من
        المعرّف مقابل جلسات KYC أولاً، ثم جلسات KYB، لذا يتم حذف كلا النوعين من
        خلال عنوان URL هذا فقط.


        **ما يتم حذفه:**

        - الجلسة وكل محاولة تحقق تحتوي عليها، بما في ذلك النتائج التي حلت محلها
        إعادة الإرسال: القرار، والبيانات المستخرجة، وجميع سجلات الميزات ذات
        الصلة (التحقق من الهوية، والوجه، وكشف الحيوية، ومطابقة الوجه، وفحص AML،
        وفحوصات السجل، وتحليل IP، وما إلى ذلك)، ومراجعاتها وسجل نشاطها.

        - جميع الملفات المخزنة المملوكة للجلسة: صور الوجهين الأمامي/الخلفي
        للمستند (النسخ الكاملة، والمقتطعة، والمموهة للخصوصية)، ومقاطع فيديو
        التقاط المستند، والقصاصات الشخصية، وصور الوجه والتوقيع من شريحة NFC،
        والصور المرجعية للوجه، ومقاطع فيديو كشف الحيوية، وصور المصدر/الهدف
        لمطابقة الوجه، ومستندات إثبات العنوان، وأي ملفات إضافية مرفوعة (KYC)؛
        ومستندات الشركة المرفوعة والملفات الإضافية (KYB). مستندات التوقيع
        الإلكتروني، وملفات PDF الموقعة، وملفات PDF للأدلة وصور التوقيع (KYC و
        KYB): تتوقف مسارات تنزيلها عن العمل. تتوقف عناوين URL للوسائط الصادرة
        سابقاً (`https://<media-host>/...`) عن العمل.

        - بيانات الوجه الخاصة بالجلسة. يتم حذف تضمين الوجه الخاص بها أيضاً، ما
        لم تختر الاحتفاظ بقالب خالٍ من الصور (راجع **البيانات البيومترية
        للوجه**).

        - عمليات تسليم webhook التي لا تزال في قائمة الانتظار للجلسة، وإعادة
        محاولاتها. لا تتأثر عمليات webhook التي تم تسليمها بالفعل.

        - بالنسبة لجلسة التحقق من الشركات (KYB): عمليات التحقق التي أنشأتها
        للأشخاص الرئيسيين (KYC) ومالكي الشركات (KYB)، بشكل متكرر، ويتم الإبلاغ
        عنها كـ `deleted_child_verifications`. لا يتم حذف عملية التحقق التي
        ترتبط بها فقط، مثل جلسة KYC موجودة مسبقاً ومقبولة تمت إعادة استخدامها.


        تختفي الجلسة من كل endpoint للقراءة فوراً: يعرض `GET
        /v3/session/{sessionId}/decision/` الرمز `404` ويتوقف `GET
        /v3/sessions/` عن إدراجها. تتوقف مراقبة AML المستمرة ومراقبة سجل KYB
        التي بدأتها عمليات التحقق المحذوفة.


        **ما لا يتأثر:** **لا** تتم إزالة إدخالات قائمة الحظر التي تم إنشاؤها من
        هذه الجلسة (الوجه أو المستند)؛ قم بإدارة هذه الإدخالات باستخدام
        endpoints قائمة الحظر. رموز المشاركة المميزة الصادرة للجلسة لا يتم
        إبطالها، ولكن لا يتبقى شيء لتستورده: الاستيراد باستخدام أحدها يعرض `400`
        مع `{"share_token": ["Original session does not exist."]}`. الأرصدة
        المستهلكة بالفعل **لا** تُسترد. الكيان الأصل، سواء كان المستخدم أو
        الشركة، **لا** يُحذف؛ استخدم `POST /v3/users/delete/` أو `POST
        /v3/businesses/delete/` لتلك الكيانات. إذا كانت الصورة الشخصية لملف
        تعريف المستخدم مأخوذة من هذه الجلسة، فستتم إزالة الصورة الشخصية معها.


        **البيانات البيومترية للوجه:** بشكل افتراضي، يتم حذف تضمين الوجه الخاص
        بالجلسة مع الجلسة (`face_retention_outcome: deleted`). يحتفظ التطبيق
        الذي اشترك في الاحتفاظ بالقالب البيومتري (`face_retention_policy:
        retain_until_user_deleted` في `PATCH /v3/webhook/`)، أو الطلب الذي يحتوي
        على `retain_face_embeddings: true`، بقالب بيومتري واحد للوجه يُدار بشكل
        منفصل وخالٍ من الصور مرتبط بمستخدم الجلسة (`retained_with_user`) حتى
        يستمر عمل كشف التكرار، والبحث بالوجه، والمصادقة البيومترية. لا يحتوي
        القالب أبداً على صورة الوجه أو الوسائط أو حقول الهوية أو القرار أو معرّف
        الجلسة المحذوفة؛ إنها بيانات بيومترية يتم حذفها عند
        `biometric_template_expires_at`، أو قبل ذلك عند حذف المستخدم، أو مسح
        الخصوصية، أو إجراء مسح صريح من خلال `/v3/biometric-templates/`. لا يمكن
        لجلسة بدون مستخدم مرتبط الاحتفاظ بقالب (`ineligible_no_vendor_user`).
        أرسل `deletion_instruction: privacy_erasure` لطلبات أصحاب البيانات: يؤدي
        ذلك إلى مسح كل قالب تم الاحتفاظ به لهذا المستخدم ولا يحتفظ أبداً بقالب
        جديد.


        **غير قابلة للإلغاء:** الحذف نهائي ولا توجد endpoint للاستعادة. قم
        بتصدير أي شيء تحتاجه (على سبيل المثال، ملف PDF للقرار) قبل استدعائه.


        **الآثار الجانبية:** لا يتم إرسال أي webhook لعمليات الحذف.


        **الاستجابة:** `200 OK` بمجرد اكتمال الحذف، مع نص JSON يوضح
        `face_retention_outcome`، وتاريخ انتهاء صلاحية القالب المحتفظ به،
        وبالنسبة لجلسة KYB، `deleted_child_verifications`. كانت الإصدارات
        السابقة من هذه الـ endpoint تعرض `204 No Content`؛ يرجى تحديث البرامج
        العميلة التي تعتمد على `204`. احتفظ بـ `instruction_id` في سجل المسح
        الخاص بك.


        **الـ idempotency:** لا تتمتع بخاصية idempotency على مستوى HTTP: يعرض
        الاستدعاء الأول `200`؛ وتكراره يعرض `404` لأن الجلسة لم تعد موجودة. بعد
        الرمز `503`، تظل الجلسة موجودة؛ كرر الطلب نفسه لإنهاء حذفها.


        **المصادقة:** أرسل مفتاح API الخاص بتطبيقك في الرأس `x-api-key`؛ يجب أن
        تنتمي الجلسة إلى ذلك التطبيق. يجوز لرموز وصول مستخدم لوحة التحكم
        (`Authorization: Bearer ...`) أيضاً استدعاء هذه الـ endpoint عندما تحمل
        الإذن `delete:sessions`. تعرض حالات فشل المصادقة وفشل الأذونات الرمز
        `403`؛ لا تعرض واجهة برمجة التطبيقات هذه الرمز `401` أبداً.


        **حد المعدل:** ميزانية كتابة مشتركة تبلغ 300 طلب/دقيقة لكل مفتاح API عبر
        جميع endpoints الخاصة بـ POST/PATCH/DELETE؛ وتجاوزها يعرض الرمز `429`.


        لحذف جلسات KYC بشكل جماعي باستخدام `session_number` الرقمي الخاص بها،
        استخدم `POST /v3/sessions/delete/` بدلاً من ذلك.


        **التقارير التنظيمية المودعة:** إذا كانت البيانات المحددة موجودة في
        تقرير تنظيمي نهائي، فسيتم رفض الطلب بأكمله برمز `409` ولن يتم حذف أي
        شيء. يستخدم جسم الاستجابة `code: in_filed_report` ويحدد كل تقرير
        باستخدام `uuid` و `report_number` و `report_type` و `case_uuid`. احذف
        التقارير، ثم كرر الطلب.
      operationId: delete_v3_session_by_id
      parameters:
        - in: path
          name: sessionId
          required: true
          description: >-
            معرّف UUID (`session_id`) لجلسة التحقق من المستخدمين (KYC) أو التحقق
            من الشركات (KYB) المراد حذفها، كما تم إرجاعه عند إنشاء الجلسة. يجب
            أن يكون معرّف UUID قياسياً مفصولاً بشرطات — أي قيمة ليست بصيغة UUID
            لا تتطابق مع المسار وترجع `404`.
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
      requestBody:
        required: false
        description: >-
          اختياري. احذف نص الطلب بالكامل لاتباع سياسة الاحتفاظ بالبيانات الخاصة
          بالتطبيق مع حذف تشغيلي.
        content:
          application/json:
            schema:
              type: object
              properties:
                retain_face_embeddings:
                  type: boolean
                  nullable: true
                  description: >-
                    تجاوز `face_retention_policy` الخاصة بالتطبيق لعملية الحذف
                    هذه. القيمة `true` تحتفظ بقالب بيومتري واحد للوجه خالٍ من
                    الصور ومرتبط بمستخدم الجلسة بعد حذف الجلسة؛ والقيمة `false`
                    تحذف تضمين الوجه مع الجلسة؛ احذف المعامل أو عيّنه كـ `null`
                    لاتباع سياسة التطبيق. يتم تجاهله لجلسات KYB وللجلسات التي لا
                    تحتوي على تضمين للوجه.
                  example: true
                face_retention_days:
                  type: integer
                  minimum: 1
                  maximum: 3650
                  description: >-
                    مدة الاحتفاظ المحدودة، بالأيام، للقالب المحتفظ به. مطلوبة
                    عند الاحتفاظ بالقالب ما لم يكن التطبيق قد عيّن بالفعل
                    `face_retention_days`. يتم تعيين `expires_at` للقالب وفقاً
                    للتاريخ الأقرب بين هذه المدة، وفترة الاحتفاظ بالبيانات
                    العامة للتطبيق، و`face_retention_deadline`.
                  example: 365
                face_retention_deadline:
                  type: string
                  format: date-time
                  description: >-
                    انتهاء صلاحية نهائي اختياري لقالب تم الاحتفاظ به. يجب أن
                    يكون في المستقبل.
                  example: '2027-08-28T00:00:00Z'
                deletion_instruction:
                  type: string
                  enum:
                    - operational_session_delete
                    - privacy_erasure
                  default: operational_session_delete
                  description: >-
                    فئة التعليمات التي تقدمها. يقوم `operational_session_delete`
                    بحذف الجلسة والاحتفاظ بالقالب فقط عندما تنص السياسة أو
                    `retain_face_embeddings` على ذلك. بينما يقوم
                    `privacy_erasure` بمسح كل قالب بيومتري تم الاحتفاظ به ومرتبط
                    بمستخدم الجلسة قبل حذف الجلسة، ولا يمكن تجاوزه بواسطة سياسة
                    التطبيق، ولا يمكن دمجه مع `retain_face_embeddings: true`
                    (`400`).
                  example: operational_session_delete
                instruction_id:
                  type: string
                  maxLength: 255
                  description: >-
                    مرجعك الدائم لتعليمات الحذف هذه (على سبيل المثال معرّف تذكرة
                    المسح). يُسجل في سجل التدقيق وعلى أي قالب يتم الاحتفاظ به.
                    تنشئه Didit عند إغفاله.
                  example: dsar-2026-0142
            examples:
              Retain a biometric template:
                summary: حذف الجلسة، والاحتفاظ بقالب خالٍ من الصور لمدة 365 يوماً
                value:
                  retain_face_embeddings: true
                  face_retention_days: 365
                  instruction_id: post-approval-cleanup-2026-08
              Force deletion on an opted-in application:
                summary: حذف تضمين الوجه بغض النظر عن سياسة التطبيق
                value:
                  retain_face_embeddings: false
              Privacy erasure:
                summary: >-
                  طلب صاحب البيانات: حذف الجلسة وتطهير كل قالب تم الاحتفاظ به
                  لهذا الشخص
                value:
                  deletion_instruction: privacy_erasure
                  instruction_id: dsar-2026-0142
      responses:
        '200':
          description: >-
            تم حذف الجلسة. يوضّح جسم الاستجابة ما حدث لبيانات الوجه البيومترية
            للجلسة، وبالنسبة لجلسة KYB، عدد عمليات التحقق التي أنشأتها وتم حذفها
            معها.
          content:
            application/json:
              schema:
                type: object
                properties:
                  session_id:
                    type: string
                    format: uuid
                    description: الجلسة المحذوفة.
                  session_number:
                    type: integer
                    nullable: true
                    description: رقم الجلسة المحذوفة.
                  face_retention_outcome:
                    type: string
                    enum:
                      - retained_with_user
                      - deleted
                      - none
                      - ineligible_no_vendor_user
                    description: >-
                      ما حدث للبيانات البيومترية للوجه الخاصة بالجلسة.
                      `deleted`: تم حذف تضمين الوجه مع الجلسة (افتراضي).
                      `retained_with_user`: يتم حذف الجلسة ويظل قالب بيومتري
                      واحد خالٍ من الصور مرتبطاً بالمستخدم؛ راجع
                      `biometric_template_uuid`. `none`: لم تتضمن الجلسة أي
                      تضمين للوجه (على سبيل المثال جلسة KYB، أو جلسة KYC بدون
                      صورة سيلفي لكشف الحيوية). `ineligible_no_vendor_user`: تم
                      طلب الاحتفاظ ولكن لا يوجد مستخدم مرتبط بالجلسة، لذا تم حذف
                      التضمين مع الجلسة. لا يتم الإبلاغ عن فشل مخزن البيانات
                      البيومترية مطلقاً عبر هذا الحقل في هذا الـ endpoint: بل
                      يُرجع `503` ولا يتم حذف الجلسة.
                  biometric_template_uuid:
                    type: string
                    format: uuid
                    nullable: true
                    description: >-
                      معرّف القالب البيومتري المحتفظ به عندما تكون قيمة
                      `face_retention_outcome` هي `retained_with_user`؛ و`null`
                      بخلاف ذلك. يمكنك إدارته عبر
                      `/v3/biometric-templates/{template_uuid}/`.
                  biometric_template_expires_at:
                    type: string
                    format: date-time
                    nullable: true
                    description: >-
                      متى يُحذف القالب البيومتري المحتفظ به، عندما تكون قيمة
                      `face_retention_outcome` هي `retained_with_user`؛ وتكون
                      `null` عند عدم الاحتفاظ بأي قالب.
                  deleted_child_verifications:
                    type: integer
                    description: >-
                      لجلسة التحقق من الشركات (KYB): عدد عمليات التحقق التي
                      أنشأتها (جلسات KYC للأشخاص الرئيسيين وجلسات KYB للشركات
                      المالكة، بشكل تكراري) والتي حُذفت معها. دائماً `0` لجلسة
                      KYC.
              examples:
                Deleted (default):
                  value:
                    session_id: 4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02
                    session_number: 1024
                    face_retention_outcome: deleted
                    biometric_template_uuid: null
                    biometric_template_expires_at: null
                    deleted_child_verifications: 0
                Retained with User:
                  value:
                    session_id: 4c5c7f3a-3b1d-4b7e-9c39-2b4f7e6a1d02
                    session_number: 1024
                    face_retention_outcome: retained_with_user
                    biometric_template_uuid: 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
                    biometric_template_expires_at: '2027-10-09T10:15:00Z'
                    deleted_child_verifications: 0
                'Ineligible: no User':
                  summary: طُلب الاحتفاظ في جلسة تم إنشاؤها بدون vendor_data
                  value:
                    session_id: 7a1e9c2d-5f4b-4c3a-8e2d-1b0a9f8e7d6c
                    session_number: 1031
                    face_retention_outcome: ineligible_no_vendor_user
                    biometric_template_uuid: null
                    biometric_template_expires_at: null
                    deleted_child_verifications: 0
                KYB session:
                  value:
                    session_id: 0f3c9b7e-2d1a-4e5f-8c6b-7a9d8e1f2c3b
                    session_number: 88
                    face_retention_outcome: none
                    biometric_template_uuid: null
                    biometric_template_expires_at: null
                    deleted_child_verifications: 3
                  summary: >-
                    عملية تحقق من الشركة تم حذفها مع عمليات التحقق الثلاث التي
                    أنشأتها لأشخاصها الرئيسيين
        '400':
          description: خطأ في التحقق من الصحة — لم يُحذف أي شيء.
          content:
            application/json:
              examples:
                Privacy erasure cannot retain:
                  value:
                    retain_face_embeddings:
                      - Privacy erasure cannot retain biometric templates.
                No finite retention duration:
                  summary: طُلب الاحتفاظ بدون face_retention_days في الطلب أو التطبيق
                  value:
                    detail: >-
                      A finite biometric-template retention duration is
                      required.
        '403':
          description: >-
            فشل في المصادقة أو الإذن. يؤدي المفتاح المفقود أيضاً إلى إرجاع
            `403`؛ بينما يؤدي المفتاح الخاطئ أو الملغى أو منتهي الصلاحية إلى
            إرجاع `401`. استثناء: عندما لا يشير `sessionId` إلى جلسة نشطة، يُرجع
            البحث عن المالك قبل المصادقة الرمز `404` أولاً، حتى مع وجود بيانات
            اعتماد مفقودة أو غير صالحة.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Missing or invalid API key:
                  summary: لا يوجد رأس x-api-key، أو أن المفتاح غير صالح
                  value:
                    detail: >-
                      Authentication credentials were not provided or are
                      invalid.
                Insufficient permission:
                  summary: >-
                    رمز token للمستخدم بدون delete:sessions، أو بيانات اعتماد
                    لتطبيق لا يملك الجلسة
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: >-
            لا توجد جلسة KYC أو KYB نشطة بهذا المعرّف `session_id` — المعرّف غير
            معروف أو تم حذف الجلسة بالفعل (تكرار عملية حذف ناجحة يؤدي إلى هذه
            النتيجة).
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Not Found:
                  summary: جلسة غير معروفة أو محذوفة بالفعل
                  value:
                    detail: Not found.
        '409':
          description: الجلسة جزء من تقرير تنظيمي نهائي. لم يتم حذف أي شيء.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InFiledReportError'
        '429':
          description: >-
            تم تجاوز حد معدل الكتابة المشترك (300 طلب POST/PATCH/DELETE في
            الدقيقة لكل مفتاح API). افحص `Retry-After` ورؤوس الاستجابة
            `X-RateLimit-*` قبل إعادة المحاولة.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Rate limited:
                  summary: تم استنفاد ميزانية الكتابة
                  value:
                    detail: >-
                      Write request rate limit exceeded. You can make up to 300
                      requests per minute.
        '503':
          description: >-
            تعذر إكمال الحذف لعدم توفر خدمة تخزين أو مخزن بيومتري أو مزود
            مراقبة. لا تزال الجلسة موجودة؛ كرر الطلب نفسه حتى يُرجع `200`. قد
            يكون بعض ملفاتها المخزنة أو تضمين الوجه الخاص بها قد حُذف بالفعل،
            لذا لا تعتمد عليها بعد تلقي `503`. تتقارب عمليات إعادة المحاولة نحو
            قالب واحد.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Session deletion unavailable:
                  summary: خدمة تخزين أو مزود مراقبة كان غير متاح
                  value:
                    detail: >-
                      The session could not be deleted because a storage service
                      or a monitoring provider is unavailable. The session is
                      still in place; repeat the request to finish deleting it.
                Biometric store unavailable:
                  summary: >-
                    كان مخزن البيانات البيومترية غير متاح أثناء الاحتفاظ بالقالب
                    أو مسحه
                  value:
                    detail: >-
                      The biometric-template operation could not finish because
                      an external store is unavailable. The operation is
                      retryable.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl (default policy)
          source: |-
            curl -X DELETE \
              https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/delete/ \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: curl
          label: curl (retain template)
          source: |-
            curl -X DELETE \
              https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/delete/ \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"retain_face_embeddings": true, "face_retention_days": 365}'
        - lang: curl
          label: curl (privacy erasure)
          source: |-
            curl -X DELETE \
              https://verification.didit.me/v3/session/11111111-2222-3333-4444-555555555555/delete/ \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"deletion_instruction": "privacy_erasure", "instruction_id": "dsar-2026-0142"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.delete(
                "11111111-2222-3333-4444-555555555555",
                retain_face_embeddings=True,
                face_retention_days=365,
                instruction_id="post-approval-cleanup-2026-08",
            )
            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.sessions.delete("11111111-2222-3333-4444-555555555555", {
              retain_face_embeddings: true,
              face_retention_days: 365,
              instruction_id: "post-approval-cleanup-2026-08",
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Sessions.Delete(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SessionsDeleteParams{\n\tRetainFaceEmbeddings: didit.Bool(true),\n\tFaceRetentionDays:    didit.Int(365),\n\tInstructionID:        didit.String(\"post-approval-cleanup-2026-08\"),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import me.didit.Didit;

            import me.didit.types.SessionsDeleteParams;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.sessions().delete("11111111-2222-3333-4444-555555555555",
            SessionsDeleteParams.builder()
                    .retainFaceEmbeddings(true)
                    .faceRetentionDays(365L)
                    .instructionId("post-approval-cleanup-2026-08")
                    .build());
            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->sessions->delete('11111111-2222-3333-4444-555555555555', [
                'retain_face_embeddings' => true,
                'face_retention_days' => 365,
                'instruction_id' => 'post-approval-cleanup-2026-08',
            ]);

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

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

            result = didit.sessions.delete(
              "11111111-2222-3333-4444-555555555555",
              retain_face_embeddings: true,
              face_retention_days: 365,
              instruction_id: "post-approval-cleanup-2026-08"
            )
            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.DeleteAsync("11111111-2222-3333-4444-555555555555",
            new SessionsDeleteParams

            {
                RetainFaceEmbeddings = true,
                FaceRetentionDays = 365,
                InstructionId = "post-approval-cleanup-2026-08",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    InFiledReportError:
      type: object
      description: >-
        رُفض الحذف لأن البيانات المحددة مدرجة في تقرير تنظيمي نهائي. لم يُحذف أي
        شيء. احذف التقرير، ثم كرر الطلب.
      required:
        - detail
        - code
      properties:
        detail:
          type: string
        code:
          type: string
          enum:
            - in_filed_report
          description: رمز خطأ ثابت لعملية حذف محظورة بسبب تقرير تنظيمي نهائي.
        reports:
          type: array
          items:
            $ref: '#/components/schemas/FiledRegulatoryReport'
          description: التقارير التي تمنع حذف شخص أو شركة أو حالة أو جلسة.
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/FiledReportTransaction'
          description: المعاملات التي تمنع حذف المعاملة، مع التقارير التي تدرج كل منها.
    FiledRegulatoryReport:
      type: object
      description: تقرير تنظيمي مكتمل يمنع الحذف المطلوب.
      required:
        - uuid
        - report_number
        - report_type
        - case_uuid
      properties:
        uuid:
          type: string
          format: uuid
          description: معرّف UUID للتقرير.
        report_number:
          type: string
          description: رقم التقرير المعروض في Console (على سبيل المثال، SAR-0001).
        report_type:
          type: string
          enum:
            - SAR
            - STR
            - CTR
            - TTR
            - UTR
            - IFT
            - CBR
            - TFR
          description: نوع التقرير التنظيمي.
        case_uuid:
          type: string
          format: uuid
          description: الحالة التي ينتمي إليها التقرير.
    FiledReportTransaction:
      type: object
      description: معاملة لا يمكن حذفها لأن تقريراً تنظيمياً نهائياً يدرجها.
      required:
        - uuid
        - transaction_id
        - reports
      properties:
        uuid:
          type: string
          format: uuid
          description: معرّف UUID لمعاملة Didit.
        transaction_id:
          type: string
          description: معرّف المعاملة المقدَّم عند إنشاء المعاملة.
        reports:
          type: array
          items:
            $ref: '#/components/schemas/FiledRegulatoryReport'
          description: التقارير المكتملة التي تتضمن هذه المعاملة.
  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.