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

**id** `string` *required*

UUID of the test case to delete.

**recursive** `boolean` (default: false)

Recursively delete child entities.

**hardDelete** `boolean` (default: false)

Permanently delete the test case. If `false`, the test case is soft-deleted and can be restored.

## Delete by Name

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

**fqn** `string` *required*

Fully qualified name of the test case.

**recursive** `boolean` (default: false)

Recursively delete child entities.

**hardDelete** `boolean` (default: false)

Permanently delete the test case.

## Restore a Soft-Deleted Test Case

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

**id** `string` *required*

UUID of the soft-deleted test case to restore.

```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
test_case = TestCases.retrieve_by_name(
    "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
    fields=["testDefinition", "testSuite"]
)
TestCases.delete(test_case.id)

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

```java DELETE /v1/dataQuality/testCases/{id} theme={null}
import java.util.Map;

// client is an initialized OpenMetadataClient.
var id = "c1bce355-fa2f-48c6-ab4d-fad722a56ed7";

// Soft delete
client.testCases().delete(id);

// Restore
client.testCases().restore(id);

// Hard delete
client.testCases().delete(id, Map.of("hardDelete", "true"));

// Delete by name: look up the ID first
var testCase = client.testCases().getByName("sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between");
client.testCases().delete(testCase.getId().toString());
```

```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"}'
```

```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": []
}
```

***

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


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