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

> 查询批量删除会话任务的状态与结果计数。当匹配会话超过 20 个时，Batch Delete Sessions 返回 202，由此接口轮询任务进度。Didit 提供支持。



获取会话删除任务提示词
        将提示词复制到剪贴板



      
      

\<pre>

\`Goal: Read the progress of a bulk session deletion that POST /v3/sessions/delete/ answered with 202. That happens when more than 20 KYC sessions match the request, whether they are selected by session_numbers or with delete_all.

Endpoint: GET https://verification.didit.me/v3/sessions/delete/{job_id}/
Auth header: x-api-key: <DIDIT_API_KEY>

Path param:
\- job_id: the job_id returned with the 202.

curl:
curl 'https://verification.didit.me/v3/sessions/delete/JOB_ID/' \
-H 'x-api-key: YOUR_API_KEY'

Response 200:
\{
"job_id": "<uuid>",
"status": "PROCESSING",            // PENDING | PROCESSING | COMPLETED | FAILED
"total": 250,                      // sessions selected when the deletion was requested
"processed": 100,                  // sessions the job has finished with so far
"outcomes": {"deleted": 82, "none": 18, "retained_with_user": 0, "ineligible_no_vendor_user": 0, "failed_retryable": 0, "already_deleted": 0},
"deleted_child_verifications": 0,  // always 0 for jobs from POST /v3/sessions/delete/ (KYC sessions only)
"error": null,                     // why the deletion stopped, when status is FAILED
"created_at": "<datetime>",
"completed_at": null
}

outcomes counts:
\- deleted: sessions deleted together with their face embedding.
\- none: sessions deleted that had no face embedding.
\- retained_with_user: sessions deleted while one image-free biometric template was retained for their User, as the request or the application policy asked.
\- ineligible_no_vendor_user: retention was requested but the session had no linked User; the session and its embedding were deleted.
\- failed_retryable: sessions reported as not deleted. The job retries a group it could not delete by itself instead of counting it here.
\- already_deleted: selected sessions that were already deleted, for example by another request, when the job reached them.

Polling: request the job every few seconds while status is PENDING or PROCESSING; stop at COMPLETED or FAILED. The job never lists which sessions it deleted, only counts. A FAILED job explains why in error; the sessions it had not reached are still in place, so repeat the deletion request to delete them. Deletion is permanent and irreversible.

Failure modes:
\- 403: missing x-api-key (a wrong, revoked or expired key gets 401). { "detail": "You do not have permission to perform this action." }
\- 404: no such job for this application (a job is only visible to the application that created it).

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

\</pre>



      
      

粘贴到

## 概述返回由 [批量删除会话](https://docs.didit.me/zh/management-api/sessions/batch-delete.md) 发起的批量会话删除任务，包括其状态、已处理的会话数量，以及各结果类别的会话数量。当批量删除（通过 `session_numbers` 选择或使用 `delete_all`）匹配的 KYC 会话超过 20 个时，请求将返回 `202` 和一个 `PENDING` 状态的任务，会话将在后台删除。请每隔几秒轮询此 endpoint，直到 `status` 变为 `COMPLETED` 或 `FAILED`。任务删除的每个会话，删除方式都与通过 [删除会话](https://docs.didit.me/zh/sessions-api/delete-session.md) 删除会话的方式完全相同：会话本身、其持有的每次验证尝试以及其所有已存储的文件都会被删除，其媒体 URL 也将失效。删除是永久性的，且不可撤销。任务只报告计数，从不列出具体删除了哪些会话。## 任务状态| `status` | 含义 |
| - | - |
| `PENDING` | 已接受，尚未开始。 |
| `PROCESSING` | 正在删除；`processed` 和 `outcomes` 正在更新。 |
| `COMPLETED` | 所选的每个会话都已在 `outcomes` 中计入。 |
| `FAILED` | 任务提前停止，`error` 说明原因。任务未处理到的会话仍然保留：请重新发送删除请求以删除这些会话。 |`delete_all` 任务只删除请求发出之前创建的会话。任务运行期间新开始的会话不会被删除。## 结果计数| `outcomes` 键 | 含义 |
| - | - |
| `deleted` | 与其人脸特征向量一同删除的会话。 |
| `none` | 删除的、没有人脸特征向量的会话。 |
| `retained_with_user` | 根据请求或应用策略的要求，在删除会话时为其用户保留了一个不含图像的生物特征模板。参见 [删除会话](https://docs.didit.me/zh/sessions-api/delete-session.md#人脸生物识别数据的删除或保留)。 |
| `ineligible_no_vendor_user` | 请求了保留，但该会话没有关联用户。会话及其人脸特征向量均已删除。 |
| `failed_retryable` | 被报告为未删除的会话。对于任务无法自行删除的分组，任务会重试，而不是将其计入此处。 |
| `already_deleted` | 所选会话中，任务处理到这些会话时已被删除的会话（例如被另一请求删除）。 |`deleted_child_verifications` 统计的是企业验证所创建的验证记录中，随企业验证一同被删除的验证数量。对于由 [批量删除会话](https://docs.didit.me/zh/management-api/sessions/batch-delete.md) 发起的任务，该值始终为 `0`，因为该接口只删除 KYC 会话。## 权限应用的任何有效 API 密钥都可以调用此 endpoint。任务仅对创建它的应用可见；任何其他 `job_id` 都将返回 `404`。## 相关内容- [批量删除会话](https://docs.didit.me/zh/management-api/sessions/batch-delete.md)
- [删除会话](https://docs.didit.me/zh/sessions-api/delete-session.md)
- [数据保留](https://docs.didit.me/zh/console/data-retention.md)


## OpenAPI

````yaml zh/openapi-25.json GET /v3/sessions/delete/{job_id}/
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/sessions/delete/{job_id}/:
    get:
      tags:
        - Sessions
      summary: 获取批量会话删除任务
      description: >-
        `POST /v3/sessions/delete/` 返回 `202` 时批量删除会话的进度（超过 20 个匹配的会话，通过
        `session_numbers` 或 `delete_all` 选择）。当 `status` 为 `PENDING` 或
        `PROCESSING` 时每隔几秒轮询一次；当其为 `COMPLETED` 或 `FAILED` 时停止。


        该任务会报告以每种结果结束的会话数量以及已处理的会话数量，绝不会报告删除了哪些会话。处于 `FAILED` 状态的任务会在 `error`
        中包含失败原因；尚未处理到的会话仍会保留，因此请重复该删除请求以删除它们。


        **身份验证：**在 `x-api-key` 请求头中提供 API 密钥。任务仅对创建它的应用可见；任何其他 `job_id` 均返回
        `404`。凭据缺失或无效将返回 `403`；此 API 绝不会返回 `401`。
      operationId: get_session_deletion_job
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: '`POST /v3/sessions/delete/` 返回 `202` 时携带的 `job_id`。'
      responses:
        '200':
          description: 作业。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionDeletionJob'
              examples:
                Processing:
                  value:
                    job_id: 5b8f2c1e-7d3a-4f6b-9e2c-1a0d8f7e6c5b
                    status: PROCESSING
                    total: 250
                    processed: 100
                    outcomes:
                      deleted: 82
                      none: 18
                      retained_with_user: 0
                      ineligible_no_vendor_user: 0
                      failed_retryable: 0
                      already_deleted: 0
                    deleted_child_verifications: 0
                    error: null
                    created_at: '2026-10-09T10:15:00Z'
                    completed_at: null
                Completed:
                  value:
                    job_id: 5b8f2c1e-7d3a-4f6b-9e2c-1a0d8f7e6c5b
                    status: COMPLETED
                    total: 250
                    processed: 250
                    outcomes:
                      deleted: 204
                      none: 44
                      retained_with_user: 0
                      ineligible_no_vendor_user: 0
                      failed_retryable: 0
                      already_deleted: 2
                    deleted_child_verifications: 0
                    error: null
                    created_at: '2026-10-09T10:15:00Z'
                    completed_at: '2026-10-09T10:16:40Z'
                Failed:
                  value:
                    job_id: 5b8f2c1e-7d3a-4f6b-9e2c-1a0d8f7e6c5b
                    status: FAILED
                    total: 250
                    processed: 100
                    outcomes:
                      deleted: 82
                      none: 18
                      retained_with_user: 0
                      ineligible_no_vendor_user: 0
                      failed_retryable: 0
                      already_deleted: 0
                    deleted_child_verifications: 0
                    error: >-
                      The deletion stopped before it finished. The sessions it
                      had not reached are still in place; repeat the request to
                      delete them.
                    created_at: '2026-10-09T10:15:00Z'
                    completed_at: '2026-10-09T10:15:52Z'
        '403':
          description: 缺少 API 密钥。缺少密钥返回 `403`；错误、已撤销或已过期的密钥返回 `401`。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Missing or invalid API key:
                  summary: 缺少 x-api-key 请求头，或该密钥无效
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: 调用方应用不存在具有此 `job_id` 的删除作业。作业仅对创建它们的应用可见。
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl 'https://verification.didit.me/v3/sessions/delete/JOB_ID/' \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.sessions.retrieve_deletion_job(
                "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.sessions.retrieveDeletionJob("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.Sessions.RetrieveDeletionJob(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.sessions().retrieveDeletionJob("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->sessions->retrieveDeletionJob('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.sessions.retrieve_deletion_job("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.Sessions.RetrieveDeletionJobAsync("11111111-2222-3333-4444-555555555555");

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    SessionDeletionJob:
      type: object
      description: 正在后台运行的批量会话删除：包含进度和按结果统计的数量，绝不包含其删除了哪些会话。
      properties:
        job_id:
          type: string
          format: uuid
          description: 使用此 ID 轮询 `GET /v3/sessions/delete/{job_id}/`。
        status:
          type: string
          enum:
            - PENDING
            - PROCESSING
            - COMPLETED
            - FAILED
          description: >-
            `PENDING`：已接受，尚未开始。`PROCESSING`：正在删除；`processed` 和 `outcomes`
            正在更新。`COMPLETED`：所有选定的会话均已处理。`FAILED`：任务提前停止；详见 `error`。
        total:
          type: integer
          description: 请求删除时选定的会话。
        processed:
          type: integer
          description: 截至目前作业已处理完成的会话。
        outcomes:
          type: object
          description: 以各项结果结束的会话数量。每个键始终存在。
          properties:
            deleted:
              type: integer
              description: 与人脸特征向量一同删除的会话。
            none:
              type: integer
              description: 已删除且不包含人脸特征向量的会话。
            retained_with_user:
              type: integer
              description: 根据请求或应用策略的要求，在为其用户保留了一个不含图像的生物特征模板的同时删除的会话。
            ineligible_no_vendor_user:
              type: integer
              description: 因请求保留但未关联用户而连同其人脸特征向量一同被删除的会话。
            failed_retryable:
              type: integer
              description: 报告为未删除的会话。作业会自动重试其自身未能删除的分组，而不会将其计入此处。
            already_deleted:
              type: integer
              description: 在任务处理到所选会话时，这些会话已被删除（例如被另一个请求删除）。
        deleted_child_verifications:
          type: integer
          description: >-
            已被删除的企业验证所创建的验证数，已随之一并删除。对于由 `POST /v3/sessions/delete/` 启动的任务，此项始终为
            `0`，因为该任务仅删除 KYC 会话。
        error:
          type: string
          nullable: true
          description: >-
            除非 `status` 为 `FAILED`，否则为
            `null`；若失败则表示删除停止的原因。该作业尚未处理到的会话仍保留在原处：可重复该请求以继续删除它们。
        created_at:
          type: string
          format: date-time
          description: 请求删除的时间。
        completed_at:
          type: string
          format: date-time
          nullable: true
          description: 任务完成时间；运行中时为 `null`。
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        您的应用 API 密钥，可在 Business Console 的“开发者 -> API
        密钥”中获取。主密钥拥有完整访问权限。指定名称的密钥可设置作用域：针对每个资源设为无权限、只读或读写，限定于特定工作流或已通过的会话、限定于
        IP 地址列表，以及设置到期日期。401 表示密钥错误、已撤销或已过期；403 表示未发送密钥、密钥无权访问该资源或操作，或请求来自其 IP
        列表之外的地址；在会话路由上返回 404 表示该会话不在该密钥允许的工作流或状态范围内。没有媒体访问权限的密钥获取到的图片、视频和 PDF
        URL 将为 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.