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

Вставьте в

Безвозвратно удаляет кейс. Вместе с ним удаляются его черновики регуляторных отчётов.

Связанные верификации, люди, компании и транзакции **не** удаляются. Эндпоинта для восстановления удалённого кейса нет.

## Заблокировано финализированным отчётом

Если у кейса есть финализированный регуляторный отчёт, запрос возвращает код `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/ru/management-api/regulatory-reports/delete.md), затем повторите этот запрос. Кейс можно удалить, когда не останется ни одного финализированного отчёта.

## Связанные материалы

* [Получить кейс](https://docs.didit.me/ru/management-api/cases/get.md)
* [Обновить кейс](https://docs.didit.me/ru/management-api/cases/update.md)
* [Удалить отчёт](https://docs.didit.me/ru/management-api/regulatory-reports/delete.md)
* [Кейсы (Console)](https://docs.didit.me/ru/console/case-management/cases.md)


## OpenAPI

````yaml ru/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: Номер отчёта, отображаемый в Console (например, 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: UUID транзакции Didit.
        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-ключ вашего приложения из раздела «Разработчикам» -> «API-ключи» в
        Business Console. Основной ключ имеет полный доступ. Именованный ключ
        может иметь ограниченную область действия: без доступа, чтение или
        запись для каждого ресурса, ограничение определенными сценариями или
        одобренными сессиями, списком IP-адресов и сроком действия. 401
        означает, что ключ неверен, отозван или его срок действия истек; 403
        означает, что ключ не был передан, у ключа нет доступа к этому ресурсу
        или действию, либо запрос поступил с адреса вне его списка IP-адресов;
        404 на маршруте сессии означает, что сессия не входит в сценарии или
        статусы ключа. Ключ без доступа к медиа получает URL изображений, видео
        и PDF как null, а ключ без прав на запись сессий получает ссылки на
        сессии и токены как null. См. https://docs.didit.me/console/api-keys.

````

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