> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete a Test Case

> Delete a test case by ID or name, with soft/hard delete options

# Delete a Test Case

Delete a test case by ID or fully qualified name. Supports soft delete (default), hard delete, and restore operations.

## Delete by ID

<ParamField path="id" type="string" required>
  UUID of the test case to delete.
</ParamField>

<ParamField query="recursive" type="boolean" default="false">
  Recursively delete child entities.
</ParamField>

<ParamField query="hardDelete" type="boolean" default="false">
  Permanently delete the test case. If `false`, the test case is soft-deleted and can be restored.
</ParamField>

## Delete by Name

Use `DELETE /v1/dataQuality/testCases/name/{fqn}` to delete by fully qualified name.

<ParamField path="fqn" type="string" required>
  Fully qualified name of the test case.
</ParamField>

<ParamField query="recursive" type="boolean" default="false">
  Recursively delete child entities.
</ParamField>

<ParamField query="hardDelete" type="boolean" default="false">
  Permanently delete the test case.
</ParamField>

## Restore a Soft-Deleted Test Case

Use `PUT /v1/dataQuality/testCases/restore` to restore a soft-deleted test case.

<ParamField body="id" type="string" required>
  UUID of the soft-deleted test case to restore.
</ParamField>

<RequestExample dropdown>
  ```python DELETE /v1/dataQuality/testCases/{id} theme={null}
  from metadata.sdk import configure
  from metadata.sdk.entities import TestCases

  configure(
      host="https://your-company.open-metadata.org/api",
      jwt_token="your-jwt-token"
  )

  # Soft delete by ID
  TestCases.delete("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")

  # Hard delete
  TestCases.delete(
      "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
      hard_delete=True
  )

  # Delete by name
  TestCases.delete_by_name(
      "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between"
  )

  # Restore a soft-deleted test case
  TestCases.restore("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
  ```

  ```java DELETE /v1/dataQuality/testCases/{id} theme={null}
  import static org.openmetadata.sdk.fluent.TestCases.*;

  // Soft delete
  TestCases.delete("c1bce355-fa2f-48c6-ab4d-fad722a56ed7").execute();

  // Hard delete
  TestCases.delete("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
      .hardDelete()
      .execute();

  // Restore
  TestCases.restore("c1bce355-fa2f-48c6-ab4d-fad722a56ed7");
  ```

  ```bash DELETE /v1/dataQuality/testCases/{id} theme={null}
  # Soft delete by ID
  curl -X DELETE "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7" \
    -H "Authorization: Bearer {access_token}"

  # Hard delete
  curl -X DELETE "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7?hardDelete=true" \
    -H "Authorization: Bearer {access_token}"

  # Delete by name
  curl -X DELETE "{base_url}/api/v1/dataQuality/testCases/name/sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between" \
    -H "Authorization: Bearer {access_token}"

  # Restore soft-deleted test case
  curl -X PUT "{base_url}/api/v1/dataQuality/testCases/restore" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{"id": "c1bce355-fa2f-48c6-ab4d-fad722a56ed7"}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response (Soft Delete) theme={null}
  {
    "id": "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
    "name": "column_value_max_to_be_between",
    "fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
    "version": 0.2,
    "updatedAt": 1769982800000,
    "updatedBy": "admin",
    "testDefinition": {
      "id": "def-id",
      "type": "testDefinition",
      "name": "columnValueMaxToBeBetween"
    },
    "testSuite": {
      "id": "suite-id",
      "type": "testSuite",
      "name": "b5fcae09-02c2-4c0b-8c4a-5b52d650e592"
    },
    "entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address::columns::shop_id>",
    "deleted": true,
    "owners": []
  }
  ```
</ResponseExample>

***

## Returns

Soft delete returns the test case object with `deleted: true`. Hard delete returns no content (204). Restore returns the restored test case object.

***

## Error Handling

| Code  | Error Type     | Description                                    |
| ----- | -------------- | ---------------------------------------------- |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token        |
| `403` | `FORBIDDEN`    | User lacks permission to delete this test case |
| `404` | `NOT_FOUND`    | Test case with given ID or FQN does not exist  |
