> ## 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 提供 GET /v3/biometric-templates/ 接口，分页列出应用保留的无图像人脸生物特征模板，可按用户、状态、来源和日期筛选。

返回您的应用当前持有的生物特征模板分页列表。已清除的模板不会出现在列表中。

## 查询参数

| 参数 | 类型 | 描述 |
| - | - | - |
| `vendor_data` | string | 按所属用户当前的 `vendor_data` 进行不区分大小写的子串匹配 |
| `vendor_user_uuid` | UUID | 与所属用户精确匹配 |
| `status` | enum | `pending`、`active`、`expired`、`held_out_of_use`、`purge_pending`、`purge_failed` |
| `source_type` | enum | `session_delete`、`automatic_retention`、`backfill` |
| `retained_from` | datetime | 保留时间晚于或等于该时间的模板 |
| `retained_to` | datetime | 保留时间早于或等于该时间的模板。不得早于 `retained_from`。 |
| `ordering` | enum | `retained_at`、`-retained_at`（默认）、`expires_at`、`-expires_at` |
| `limit` | integer | 每页数量 |
| `offset` | integer | 分页偏移量 |

## 示例

```bash theme={null}
curl -X GET "https://verification.didit.me/v3/biometric-templates/?vendor_data=user-42&status=active" \
  -H "x-api-key: YOUR_API_KEY"
```

```json theme={null}
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "uuid": "9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b",
      "vendor_user_uuid": "2f7c1a9e-8b4d-4c6a-9e1f-3d5b7a9c1e2f",
      "vendor_data": "user-42",
      "source_type": "session_delete",
      "provenance_reference": "6b1e8d2f-4a3c-4f9e-8c7d-1a2b3c4d5e6f",
      "retention_policy": "retain_until_user_deleted",
      "retention_override": null,
      "retained_at": "2026-08-28T10:15:42.318402Z",
      "expires_at": "2027-08-28T10:15:42.318402Z",
      "retained_by": "3c9e2b1f-7d4a-4e8b-9c1d-5f6a7b8c9d0e",
      "retained_by_type": "API_KEY",
      "instruction_class": "operational_session_delete",
      "instruction_source": "api",
      "instruction_id": "post-approval-cleanup-2026-08",
      "held_out_of_use": false,
      "status": "active",
      "purged_at": null
    }
  ]
}
```

请参阅[概述](https://docs.didit.me/zh/management-api/biometric-templates/overview.md#模板对象)了解所有字段。

## 错误

| 状态码 | 触发条件 |
| - | - |
| `400` | 筛选值无效，或 `retained_to` 早于 `retained_from` |
| `403` | 使用了控制台用户 token，或该 API 密钥不允许访问 |


## OpenAPI

````yaml zh/openapi-25.json GET /v3/biometric-templates/
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/biometric-templates/:
    get:
      tags:
        - Biometric Templates
      summary: 列出保留的生物特征模板
      description: >-
        选择启用的应用在会话被删除时（参见 `DELETE
        /v3/session/{sessionId}/delete/`），会保留一个锚定到用户的、独立管理的无图像人脸生物特征模板。模板是具有有限
        `expires_at` 的生物识别数据；它们绝不包含图像、会话数据或身份字段，并在用户删除、隐私清除、过期或明确清除时被清除。这些
        endpoint 仅接受应用 API 密钥（`x-api-key`）；Business Console 用户 token 将被拒绝并返回
        `403`。


        返回应用当前持有的模板的分页列表。已清除的模板不会被列出。
      operationId: list_biometric_templates
      parameters:
        - in: query
          name: vendor_data
          required: false
          description: 对所属用户的当前 `vendor_data` 进行不区分大小写的子字符串匹配。
          schema:
            type: string
        - in: query
          name: vendor_user_uuid
          required: false
          description: 对所属用户的精确匹配。
          schema:
            type: string
            format: uuid
        - in: query
          name: status
          required: false
          description: 生命周期状态。已清除的模板绝不会被列出。
          schema:
            type: string
            enum:
              - pending
              - active
              - expired
              - held_out_of_use
              - purge_pending
              - purge_failed
        - in: query
          name: source_type
          required: false
          description: 模板的创建方式。
          schema:
            type: string
            enum:
              - session_delete
              - automatic_retention
              - backfill
        - in: query
          name: retained_from
          required: false
          description: 在此时间或之后保留的模板。
          schema:
            type: string
            format: date-time
        - in: query
          name: retained_to
          required: false
          description: 在此时间或之前保留的模板。不得早于 `retained_from`（`400`）。
          schema:
            type: string
            format: date-time
        - in: query
          name: ordering
          required: false
          description: 排序顺序。
          schema:
            type: string
            enum:
              - retained_at
              - '-retained_at'
              - expires_at
              - '-expires_at'
            default: '-retained_at'
        - in: query
          name: limit
          required: false
          description: 页面大小。
          schema:
            type: integer
        - in: query
          name: offset
          required: false
          description: 分页偏移量。
          schema:
            type: integer
      responses:
        '200':
          description: 分页模板列表。
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                  next:
                    type: string
                    nullable: true
                  previous:
                    type: string
                    nullable: true
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        uuid:
                          type: string
                          format: uuid
                          description: 模板 ID。随机生成；并非衍生自已删除的会话或其人脸。
                        vendor_user_uuid:
                          type: string
                          format: uuid
                          description: 所有者用户。
                        vendor_data:
                          type: string
                          nullable: true
                          description: 用户的当前 `vendor_data`，在您读取模板时解析（绝不会被复制）。
                        source_type:
                          type: string
                          enum:
                            - session_delete
                            - automatic_retention
                            - backfill
                          description: >-
                            模板的创建方式：会话删除（API 或 Console）、应用的数据自动保留期限，或者根据您的指示由
                            Didit 执行的历史回填。
                        provenance_reference:
                          type: string
                          format: uuid
                          description: 将模板与其审计日志关联的不透明引用。它不是已删除会话的 id，且无法解析为该 id。
                        retention_policy:
                          type: string
                          enum:
                            - delete_with_session
                            - retain_until_user_deleted
                          description: 在保留时间到达时适用的应用策略。
                        retention_override:
                          type: boolean
                          nullable: true
                          description: 删除请求中发送的 `retain_face_embeddings` 值，应用策略时为 `null`。
                        retained_at:
                          type: string
                          format: date-time
                        expires_at:
                          type: string
                          format: date-time
                          description: 模板到期并被自动清除的时间。始终设置。
                        retained_by:
                          type: string
                          nullable: true
                          description: >-
                            发出指令的主体：API 密钥对应的应用 ID、控制台操作对应的控制台成员 ID，或自动数据保留对应的
                            `service:` 标识符。绝不为邮箱地址。
                        retained_by_type:
                          type: string
                          enum:
                            - API_KEY
                            - CONSOLE_USER
                            - SYSTEM
                        instruction_class:
                          type: string
                          enum:
                            - operational_session_delete
                            - privacy_erasure
                        instruction_source:
                          type: string
                          enum:
                            - api
                            - console
                            - automatic_retention
                            - backfill
                            - privacy_erasure
                            - explicit_template_purge
                            - vendor_user_delete
                            - expiry
                            - reconciliation
                            - migration
                            - system
                        instruction_id:
                          type: string
                          description: 删除请求中发送的 `instruction_id`，或由 Didit 生成的 id。
                        held_out_of_use:
                          type: boolean
                          description: 仅在法律保留生效期间为 `true`。处于保留状态的模板将从所有匹配中排除。
                        status:
                          type: string
                          enum:
                            - pending
                            - active
                            - expired
                            - held_out_of_use
                            - purge_pending
                            - purge_failed
                            - purged
                          description: >-
                            只有处于 `active` 状态、未被暂停、未超过 `expires_at`
                            且其用户仍然存在的模板才会参与比对。
                        purged_at:
                          type: string
                          format: date-time
                          nullable: true
              examples:
                One active template:
                  value:
                    count: 1
                    next: null
                    previous: null
                    results:
                      - uuid: 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
                        vendor_user_uuid: 2f7c1a9e-8b4d-4c6a-9e1f-3d5b7a9c1e2f
                        vendor_data: user-42
                        source_type: session_delete
                        provenance_reference: 6b1e8d2f-4a3c-4f9e-8c7d-1a2b3c4d5e6f
                        retention_policy: retain_until_user_deleted
                        retention_override: null
                        retained_at: '2026-08-28T10:15:42.318402Z'
                        expires_at: '2027-08-28T10:15:42.318402Z'
                        retained_by: 3c9e2b1f-7d4a-4e8b-9c1d-5f6a7b8c9d0e
                        retained_by_type: API_KEY
                        instruction_class: operational_session_delete
                        instruction_source: api
                        instruction_id: post-approval-cleanup-2026-08
                        held_out_of_use: false
                        status: active
                        purged_at: null
        '400':
          description: 无效的过滤值，或 `retained_to` 早于 `retained_from`。按字段索引的验证错误。
          content:
            application/json:
              examples:
                Bad range:
                  value:
                    retained_to:
                      - Must be on or after retained_from.
        '403':
          description: Console 用户 token，或该 API 密钥不被允许。这些 endpoint 仅接受应用 API 密钥。
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    detail: You do not have permission to perform this action.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X GET
            'https://verification.didit.me/v3/biometric-templates/?vendor_data=user-42&status=active'
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            for item in client.biometric_templates.list():
                print(item)
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // Reads DIDIT_API_KEY.
            const didit = new Didit();

            for await (const item of didit.biometricTemplates.list()) {
              console.log(item);
            }
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\niter := client.BiometricTemplates.ListAutoPaging(ctx, didit.BiometricTemplatesListParams{})\nfor iter.Next() {\n\tfmt.Printf(\"%+v\\n\", iter.Current())\n}\nif err := iter.Err(); err != nil {\n\tlog.Fatal(err)\n}"
        - lang: java
          label: Java
          source: |-
            import me.didit.Didit;

            // Reads DIDIT_API_KEY.
            Didit client = new Didit();

            for (var item : client.biometricTemplates().list()) {
                System.out.println(item);
            }
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // Reads DIDIT_API_KEY.
            $didit = new DiditClient();

            foreach ($didit->biometricTemplates->list() as $item) {
                print_r($item->toArray());
            }
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            didit.biometric_templates.list.auto_paging_each do |item|
              puts item.to_h
            end
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            await foreach (var item in await
            client.BiometricTemplates.ListAsync())

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