> ## 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 删除合规案件及其草稿监管报告。已定稿的报告会阻止删除，须先删除该报告。

删除案件 API 提示词
将提示词复制到剪贴板

<pre>
  \`Delete a compliance case through the Management API.

  Endpoint:
  DELETE [https://verification.didit.me/v3/organization/\{organization\_id}/application/\{application\_id}/cases/\{case\_uuid}/](https://verification.didit.me/v3/organization/\{organization_id}/application/\{application_id}/cases/\{case_uuid}/)

  Authentication:
  Use the x-api-key header with my Didit API key. Use a full-access API key; the caller needs write:cases.

  Request body: none.

  Example call:
  curl -X DELETE "[https://verification.didit.me/v3/organization/\{organization\_id}/application/\{application\_id}/cases/\{case\_uuid}/](https://verification.didit.me/v3/organization/\{organization_id}/application/\{application_id}/cases/\{case_uuid}/)" \
  -H "x-api-key: YOUR\_API\_KEY"

  Response 204: the case is deleted.

  What is deleted:

  * The case.
  * Its draft regulatory reports.
    Linked verifications, people, companies and transactions are NOT deleted. There is no undelete endpoint.

  Failure modes:

  * 409 - the case has a finalized regulatory report. Nothing is deleted. The body has code: in\_filed\_report and names each report with uuid, report\_number, report\_type and case\_uuid. Delete the reports, then repeat this request.
  * 403 - the key cannot delete cases (requires a full-access key and write:cases).
  * 404 - the case does not exist in this application or was already deleted.

  For the full integration shape, see /integration/integration-prompt.\`
</pre>

粘贴到

永久删除案件。其草稿监管报告将随案件一并删除。

关联的验证、人员、企业和交易**不会**被删除。没有用于撤销删除的 endpoint。

## 因已定稿报告而无法删除

如果案件包含已定稿的监管报告，整个请求将返回 `409`，且不会删除任何内容：

```json theme={null}
{
  "detail": "This case has 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/zh/management-api/regulatory-reports/delete.md)逐一删除每份报告，然后重新发送此请求。当不再有已定稿报告时，即可删除该案件。

## 相关内容

* [获取案件](https://docs.didit.me/zh/management-api/cases/get.md)
* [更新案件](https://docs.didit.me/zh/management-api/cases/update.md)
* [删除报告](https://docs.didit.me/zh/management-api/regulatory-reports/delete.md)
* [案件（控制台）](https://docs.didit.me/zh/console/case-management/cases.md)


## OpenAPI

````yaml zh/openapi-25.json DELETE /v3/organization/{organization_id}/application/{application_id}/cases/{case_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/organization/{organization_id}/application/{application_id}/cases/{case_uuid}/:
    delete:
      tags:
        - Cases
      summary: 删除案件
      description: >-
        永久删除一个案件。其草稿监管报告也会随之一同删除。关联的验证、人员、企业和交易不会被删除。不存在恢复删除的 endpoint。


        如果案件包含已定稿的监管报告，整个请求将被拒绝并返回 `409`，且不会删除任何内容。响应体使用 `code:
        in_filed_report`，并通过 `uuid`、`report_number`、`report_type` 和 `case_uuid`
        列出每份报告。请先删除这些报告，然后重试请求。
      operationId: delete_case
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 组织 UUID。
        - name: application_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 应用 UUID。
        - name: case_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
            example: c1a5e000-0000-4000-8000-000000000001
          description: 案件 UUID。
      responses:
        '204':
          description: 案件已删除。
        '403':
          description: 该密钥无法删除案件。它需要具有 `write:cases` 权限的全权访问密钥。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
        '404':
          description: 该案件在此应用中不存在或已被删除。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
        '409':
          description: 该案件已有定稿的监管报告。未删除任何内容。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InFiledReportError'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X DELETE
            'https://verification.didit.me/v3/organization/11111111-2222-3333-4444-555555555555/application/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/cases/c1a5e000-0000-4000-8000-000000000001/'
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID
            # and DIDIT_APPLICATION_ID.
            client = Didit()

            client.cases.delete(
                "c1a5e000-0000-4000-8000-000000000001",
            )
        - lang: javascript
          label: Node.js
          source: |-
            import Didit from "@didit-protocol/sdk-node";

            // Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID
            // and DIDIT_APPLICATION_ID.
            const didit = new Didit();

            await didit.cases.delete("c1a5e000-0000-4000-8000-000000000001");
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID\n// and DIDIT_APPLICATION_ID.\nclient := didit.NewClient()\n\nif err := client.Cases.Delete(ctx, \"c1a5e000-0000-4000-8000-000000000001\"); err != nil {\n\tlog.Fatal(err)\n}"
        - lang: java
          label: Java
          source: |-
            import me.didit.Didit;

            // Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID
            // and DIDIT_APPLICATION_ID.
            Didit client = new Didit();

            client.cases().delete("c1a5e000-0000-4000-8000-000000000001");
        - lang: php
          label: PHP
          source: |-
            <?php

            require 'vendor/autoload.php';

            use Didit\DiditClient;

            // Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID
            // and DIDIT_APPLICATION_ID.
            $didit = new DiditClient();

            $didit->cases->delete('c1a5e000-0000-4000-8000-000000000001');
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID
            # and DIDIT_APPLICATION_ID.
            didit = Didit::Client.new

            didit.cases.delete("c1a5e000-0000-4000-8000-000000000001")
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using Didit;


            // Reads DIDIT_API_KEY, DIDIT_ORGANIZATION_ID

            // and DIDIT_APPLICATION_ID.

            using var client = new DiditClient();


            await
            client.Cases.DeleteAsync("c1a5e000-0000-4000-8000-000000000001");
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: 在控制台中显示的报告编号（例如 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: Didit 交易 UUID。
        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 密钥，可在 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.