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

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

# Delete a Container

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

## Delete by ID

**id** `string` *required*

UUID of the container to delete.

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

Recursively delete child containers.

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

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

## Delete by Name

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

**fqn** `string` *required*

Fully qualified name of the container, for example `s3_datalake.analytics-bucket`.

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

Recursively delete child containers.

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

Permanently delete the container.

## Restore a Soft-Deleted Container

Use `PUT /v1/containers/restore` to restore a soft-deleted container.

**id** `string` *required*

UUID of the soft-deleted container to restore.

```python DELETE /v1/containers/{id} theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import Containers

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

# Soft delete by ID
Containers.delete("14744329-85c2-499e-b1fa-249fb8162341")

# Hard delete
Containers.delete(
    "14744329-85c2-499e-b1fa-249fb8162341",
    hard_delete=True
)

# Delete by name (look up the ID first)
entity = Containers.retrieve_by_name("s3_datalake.analytics-bucket")
Containers.delete(entity.id)

# Delete by name with options
entity = Containers.retrieve_by_name("s3_datalake.analytics-bucket")
Containers.delete(entity.id, hard_delete=True, recursive=True)

# Restore a soft-deleted container
Containers.restore("14744329-85c2-499e-b1fa-249fb8162341")
```

```java DELETE /v1/containers/{id} theme={null}
import java.util.Map;
import org.openmetadata.sdk.network.HttpMethod;

// client is an initialized OpenMetadataClient.

// Soft delete
client.containers().delete("14744329-85c2-499e-b1fa-249fb8162341");

// Hard delete
client.containers().delete("14744329-85c2-499e-b1fa-249fb8162341", Map.of("hardDelete", "true"));

// Delete by name
client.getHttpClient().execute(
    HttpMethod.DELETE,
    "/v1/containers/name/s3_datalake.analytics-bucket",
    null,
    Void.class
);

// Restore
client.containers().restore("14744329-85c2-499e-b1fa-249fb8162341");
```

```bash DELETE /v1/containers/{id} theme={null}
# Soft delete by ID
curl -X DELETE "{base_url}/api/v1/containers/14744329-85c2-499e-b1fa-249fb8162341" \
  -H "Authorization: Bearer {access_token}"

# Hard delete
curl -X DELETE "{base_url}/api/v1/containers/14744329-85c2-499e-b1fa-249fb8162341?hardDelete=true" \
  -H "Authorization: Bearer {access_token}"

# Delete by name
curl -X DELETE "{base_url}/api/v1/containers/name/s3_datalake.analytics-bucket" \
  -H "Authorization: Bearer {access_token}"

# Restore soft-deleted container
curl -X PUT "{base_url}/api/v1/containers/restore" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{"id": "14744329-85c2-499e-b1fa-249fb8162341"}'
```

```json Response (Soft Delete) theme={null}
{
  "id": "14744329-85c2-499e-b1fa-249fb8162341",
  "name": "analytics-bucket",
  "displayName": "Analytics Bucket",
  "fullyQualifiedName": "s3_datalake.analytics-bucket",
  "description": "Primary analytics data lake bucket",
  "version": 0.2,
  "updatedAt": 1769982673032,
  "updatedBy": "admin",
  "service": {
    "id": "d1589e1d-2ab0-431c-a383-15e4be20a106",
    "type": "storageService",
    "name": "s3_datalake",
    "fullyQualifiedName": "s3_datalake"
  },
  "serviceType": "S3",
  "deleted": true,
  "owners": [],
  "tags": [],
  "domains": []
}
```

***

## Returns

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

***

## Error Handling

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


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