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

# Bulk Purge Biometric Templates

> POST /v3/biometric-templates/delete/ — purge retained face biometric templates by id list, or every template matching a filter. Idempotent per template.

Purges many templates in one call. Provide either an explicit id list or `delete_all: true`, optionally narrowed by the same filters as [List Biometric Templates](/management-api/biometric-templates/list).

## Request body

| Field                          | Type     | Description                                                                                                                                                  |
| ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `template_uuids`               | UUID\[]  | Templates to purge. Required unless `delete_all` is `true`. Ids that are already purged are reported as `already_purged`.                                    |
| `delete_all`                   | boolean  | When `true`, purges every template that matches the filters below (all of the application's templates when no filter is given). `template_uuids` is ignored. |
| `vendor_data`                  | string   | Only with `delete_all`: case-insensitive substring match on the owning User's `vendor_data`                                                                  |
| `vendor_user_uuid`             | UUID     | Only with `delete_all`: exact match on the owning User                                                                                                       |
| `status`                       | enum     | Only with `delete_all`: `pending`, `active`, `expired`, `held_out_of_use`, `purge_pending`, `purge_failed`                                                   |
| `source_type`                  | enum     | Only with `delete_all`: `session_delete`, `automatic_retention`, `backfill`                                                                                  |
| `retained_from`, `retained_to` | datetime | Only with `delete_all`: retained-date range                                                                                                                  |

<Warning>
  `delete_all: true` without filters purges every biometric template in the application and cannot be undone. Run [Count Biometric Templates](/management-api/biometric-templates/count) with the same filters first to confirm what will be purged.
</Warning>

## Examples

<Tabs>
  <Tab title="By id">
    ```bash theme={null}
    curl -X POST https://verification.didit.me/v3/biometric-templates/delete/ \
      -H "x-api-key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"template_uuids": ["9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b", "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"]}'
    ```
  </Tab>

  <Tab title="Every template of one User">
    ```bash theme={null}
    curl -X POST https://verification.didit.me/v3/biometric-templates/delete/ \
      -H "x-api-key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"delete_all": true, "vendor_user_uuid": "2f7c1a9e-8b4d-4c6a-9e1f-3d5b7a9c1e2f"}'
    ```
  </Tab>

  <Tab title="Every template in the application">
    ```bash theme={null}
    curl -X POST https://verification.didit.me/v3/biometric-templates/delete/ \
      -H "x-api-key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"delete_all": true}'
    ```
  </Tab>
</Tabs>

```json theme={null}
{
  "results": [
    { "uuid": "9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b", "outcome": "purged" },
    { "uuid": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "outcome": "already_purged" }
  ]
}
```

Templates are purged one by one; each result reports `purged` or `already_purged`. If a biometric store is unavailable the call returns `503` at the first failing template; templates purged earlier in the same request stay purged, the failing one moves to `purge_failed` (already excluded from matching), and repeating the request finishes the job.

## Errors

| Status | When                                                                | Body                                                                                                                                    |
| ------ | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `400`  | Neither `template_uuids` nor `delete_all: true` provided            | `{"template_uuids": ["This field is required unless delete_all is true."]}`                                                             |
| `400`  | Invalid filter value, or `retained_to` earlier than `retained_from` | Field-keyed validation errors                                                                                                           |
| `403`  | Console user token, or the API key is not allowed                   | `{"detail": "You do not have permission to perform this action."}`                                                                      |
| `503`  | A biometric store was unavailable; repeat the request               | `{"detail": "The biometric-template operation could not finish because an external store is unavailable. The operation is retryable."}` |


## OpenAPI

````yaml POST /v3/biometric-templates/delete/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: Identity verification API. Authenticate with x-api-key header.
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/biometric-templates/delete/:
    post:
      tags:
        - Biometric Templates
      summary: Bulk purge retained biometric templates
      description: >-
        An opted-in application keeps one separately managed, image-free face
        biometric template anchored to the User when a session is deleted (see
        `DELETE /v3/session/{sessionId}/delete/`). Templates are biometric data
        with a finite `expires_at`; they never contain images, session data, or
        identity fields, and they are purged on User deletion, privacy erasure,
        expiry, or an explicit purge. These endpoints accept application API
        keys (`x-api-key`) only; Business Console user tokens are rejected with
        `403`.


        Purges many templates in one call, by explicit id list or with
        `delete_all: true` optionally narrowed by the same filters as the list
        endpoint. Templates are purged one by one and each result reports
        `purged` or `already_purged`. If a biometric store is unavailable the
        call returns `503` at the first failing template: templates purged
        earlier in the request stay purged, the failing one moves to
        `purge_failed` (already excluded from matching), and repeating the
        request finishes the job.


        **`delete_all: true` without filters purges every biometric template in
        the application and cannot be undone.** Run the count endpoint with the
        same filters first.
      operationId: bulk_purge_biometric_templates
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                template_uuids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  minItems: 1
                  description: >-
                    Templates to purge. Required unless `delete_all` is `true`.
                    Already purged ids are reported as `already_purged`.
                delete_all:
                  type: boolean
                  default: false
                  description: >-
                    When `true`, purges every template matching the filters
                    below (all of the application's templates when no filter is
                    given). `template_uuids` is ignored. Irreversible.
                vendor_data:
                  type: string
                  description: >-
                    Only with `delete_all`: case-insensitive substring match on
                    the owning User's `vendor_data`.
                vendor_user_uuid:
                  type: string
                  format: uuid
                  description: 'Only with `delete_all`: exact match on the owning User.'
                status:
                  type: string
                  enum:
                    - pending
                    - active
                    - expired
                    - held_out_of_use
                    - purge_pending
                    - purge_failed
                  description: Only with `delete_all`.
                source_type:
                  type: string
                  enum:
                    - session_delete
                    - automatic_retention
                    - backfill
                  description: Only with `delete_all`.
                retained_from:
                  type: string
                  format: date-time
                  description: Only with `delete_all`.
                retained_to:
                  type: string
                  format: date-time
                  description: >-
                    Only with `delete_all`. Must not be earlier than
                    `retained_from`.
            examples:
              By id:
                value:
                  template_uuids:
                    - 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
                    - 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
              Every template of one User:
                value:
                  delete_all: true
                  vendor_user_uuid: 2f7c1a9e-8b4d-4c6a-9e1f-3d5b7a9c1e2f
              Every template in the application:
                value:
                  delete_all: true
      responses:
        '200':
          description: Per-template purge outcomes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        uuid:
                          type: string
                          format: uuid
                        outcome:
                          type: string
                          enum:
                            - purged
                            - already_purged
              examples:
                Mixed:
                  value:
                    results:
                      - uuid: 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
                        outcome: purged
                      - uuid: 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
                        outcome: already_purged
        '400':
          description: Validation error — nothing is purged.
          content:
            application/json:
              examples:
                Missing selector:
                  value:
                    template_uuids:
                      - This field is required unless delete_all is true.
                Bad range:
                  value:
                    retained_to:
                      - Must be on or after retained_from.
        '403':
          description: >-
            Console user token, or the API key is not allowed. These endpoints
            accept application API keys only.
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    detail: You do not have permission to perform this action.
        '503':
          description: >-
            A biometric store was unavailable while retaining or purging a
            biometric template. Nothing is deleted; repeat the same request.
            Retries are idempotent and converge on a single template.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              examples:
                Retryable:
                  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
          source: >-
            curl -X POST
            https://verification.didit.me/v3/biometric-templates/delete/ \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"delete_all": true, "vendor_user_uuid": "2f7c1a9e-8b4d-4c6a-9e1f-3d5b7a9c1e2f"}'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````