> ## 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（Purge）

> Didit Management APIのDELETE /v3/biometric-templates/{template_uuid}/で、保持中の顔の生体認証テンプレートを1件完全削除。照合対象から外し、保存データも削除します。冪等です。

テンプレートを1件パージします。テンプレートはあらゆる種類の照合から除外され、保存されているテンプレートは削除されます。パージは元に戻せず、実行したプリンシパルとともに監査証跡に記録されます。

```bash theme={null}
curl -X DELETE https://verification.didit.me/v3/biometric-templates/9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b/ \
  -H "x-api-key: YOUR_API_KEY"
```

```json theme={null}
{ "uuid": "9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b", "outcome": "purged" }
```

| `outcome` | 意味 |
| - | - |
| `purged` | この呼び出しによってテンプレートがパージされました。 |
| `already_purged` | テンプレートはすでにパージされています。パージを繰り返しても問題ありません。 |

## 再試行のセマンティクス

Diditは、保存されているテンプレートを先に削除し、その後でのみテンプレートをパージ済みとしてマークします。生体認証ストアが利用できない場合、呼び出しは`503`を返し、テンプレートは`status: purge_failed`に移行します。この時点でテンプレートはすでに照合から除外されています。パージを完了するには、同じ呼び出しを繰り返してください。

## エラー

| ステータス | 発生条件 | ボディ |
| - | - | - |
| `403` | コンソールのユーザートークンを使用した場合、またはAPIキーが許可されていない場合 | `{"detail": "You do not have permission to perform this action."}` |
| `404` | 存在しないテンプレート、または別のアプリケーションのテンプレートの場合 | `{"detail": "Biometric template not found."}` |
| `503` | 生体認証ストアが利用できなかった場合。テンプレートは`purge_failed`の状態になり、照合から除外されています。呼び出しを再試行してください。 | `{"detail": "The biometric-template operation could not finish because an external store is unavailable. The operation is retryable."}` |

## その他のパージ契機

テンプレートは、[Batch Delete Users](https://docs.didit.me/ja/management-api/users/delete.md)でテンプレートを所有するUserを削除したとき、そのUserのいずれかのセッションを`deletion_instruction: "privacy_erasure"`で削除したとき、および`expires_at`になると自動的にパージされます。詳しくは[パージ契機](https://docs.didit.me/ja/management-api/biometric-templates/overview.md#消去ポイント)を参照してください。


## OpenAPI

````yaml ja/openapi-25.json DELETE /v3/biometric-templates/{template_uuid}/
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/{template_uuid}/:
    delete:
      tags:
        - Biometric Templates
      summary: 保持されている生体認証テンプレートを完全削除する
      description: >-
        オプトインしたアプリケーションは、セッションが削除されたとき（`DELETE
        /v3/session/{sessionId}/delete/`を参照）、ユーザーに紐づけて、個別に管理される画像を含まない顔の生体認証テンプレートを1つ保持します。テンプレートは有限の`expires_at`を持つ生体データです。画像、セッションデータ、本人情報のフィールドは一切含まず、ユーザーの削除、プライバシー消去、有効期限切れ、または明示的なパージによって完全に削除されます。これらのエンドポイントはアプリケーションのAPIキー（`x-api-key`）のみを受け付け、Business
        Consoleのユーザートークンは`403`で拒否されます。


        テンプレートを1件パージします。テンプレートはあらゆる種類の照合から除外され、保存されたテンプレートは削除されます。この操作は取り消せず、実行したプリンシパルとともに監査証跡に記録されます。


        **再試行の動作:**
        Diditはまず保存されたテンプレートを削除し、その後でテンプレートをパージ済みとしてマークします。生体データストアが利用できない場合は`503`が返され、テンプレートは`status:
        purge_failed`に移行し、照合対象からは既に除外されています。同じ呼び出しを繰り返すと処理が完了します。既にパージされたテンプレートに対してパージを繰り返すと`already_purged`が返されます。


        テンプレートは、所有するユーザーに対する`POST
        /v3/users/delete/`、そのユーザーのセッションを`deletion_instruction:
        privacy_erasure`で削除するあらゆる操作、および`expires_at`時点での自動処理によってもパージされます。
      operationId: purge_biometric_template
      parameters:
        - in: path
          name: template_uuid
          required: true
          description: >-
            テンプレートID。セッション削除エンドポイントが返す`biometric_template_uuid`、顔検索の一致結果の`biometric_template_id`、または一覧エンドポイントで返される値です。
          schema:
            type: string
            format: uuid
            example: 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
      responses:
        '200':
          description: 完全削除の結果。
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    type: string
                    format: uuid
                  outcome:
                    type: string
                    enum:
                      - purged
                      - already_purged
              examples:
                Purged:
                  value:
                    uuid: 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
                    outcome: purged
                Already purged:
                  value:
                    uuid: 9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b
                    outcome: already_purged
        '403':
          description: >-
            コンソールユーザートークンが使用されたか、APIキーが許可されていません。これらのエンドポイントはアプリケーションのAPIキーのみを受け付けます。
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: 不明なテンプレート、別のアプリケーションのテンプレート、または(`GET`の場合)完全に削除されたテンプレートです。
          content:
            application/json:
              examples:
                Not found:
                  value:
                    detail: Biometric template not found.
        '503':
          description: >-
            生体認証テンプレートの保持または消去中に、生体認証ストアが利用できませんでした。何も削除されていません。同じリクエストを再度送信してください。再試行は冪等で、単一のテンプレートに収束します。
          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 DELETE
            https://verification.didit.me/v3/biometric-templates/9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b/
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.biometric_templates.delete(
                "9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b",
            )
            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.biometricTemplates.delete("9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b");

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.BiometricTemplates.Delete(ctx, \"9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b\")\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.biometricTemplates().delete("9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b");

            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->biometricTemplates->delete('9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b');

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


            # Reads DIDIT_API_KEY.

            didit = Didit::Client.new


            result =
            didit.biometric_templates.delete("9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b")

            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.BiometricTemplates.DeleteAsync("9d2f4b6e-1c3a-4e8f-b7d5-0a1c2e3f4a5b");

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        お客様のアプリケーションのAPIキーです。Business ConsoleのDevelopers -> API
        keysで取得できます。プライマリキーはフルアクセス権を持ちます。名前付きキーにはスコープを設定できます。リソースごとのアクセス権（なし、読み取り、書き込み）、一部のワークフローまたは承認済みセッションへの限定、IPアドレスのリストへの限定、有効期限の設定です。401は、キーが誤っている、失効している、または期限切れであることを意味します。403は、キーが送信されていない、キーにこのリソースやアクションへのアクセス権がない、またはIPリスト外のアドレスからリクエストが送信されたことを意味します。セッションのルートでの404は、セッションがキーのワークフローまたはステータスの対象外であることを意味します。メディアへのアクセス権がないキーでは、画像、動画、PDFのURLがnullで返されます。セッションの書き込み権限がないキーでは、セッションのリンクとトークンがnullで返されます。詳細は次を参照してください:
        https://docs.didit.me/console/api-keys

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.