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

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

# Delete a Topic

Delete a topic 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 topic 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 topic. If `false`, the topic is soft-deleted and can be restored.
</ParamField>

## Delete by Name

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

<ParamField path="fqn" type="string" required>
  Fully qualified name of the topic (e.g., `sample_kafka.address_book`).
</ParamField>

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

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

## Restore a Soft-Deleted Topic

Use `PUT /v1/topics/restore` to restore a soft-deleted topic.

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

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

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

  # Soft delete by ID
  Topics.delete("0a021819-982e-4ee4-a5a2-4af30eaa3016")

  # Hard delete
  Topics.delete(
      "0a021819-982e-4ee4-a5a2-4af30eaa3016",
      hard_delete=True
  )

  # Delete by name
  Topics.delete_by_name("sample_kafka.address_book")

  # Delete by name with options
  Topics.delete_by_name(
      "sample_kafka.address_book",
      hard_delete=True
  )

  # Restore a soft-deleted topic
  Topics.restore("0a021819-982e-4ee4-a5a2-4af30eaa3016")
  ```

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

  // Soft delete
  Topics.delete("0a021819-982e-4ee4-a5a2-4af30eaa3016").execute();

  // Hard delete
  Topics.delete("0a021819-982e-4ee4-a5a2-4af30eaa3016")
      .hardDelete()
      .execute();

  // Delete by name
  Topics.deleteByName("sample_kafka.address_book")
      .execute();

  // Restore
  Topics.restore("0a021819-982e-4ee4-a5a2-4af30eaa3016");
  ```

  ```bash DELETE /v1/topics/{id} theme={null}
  # Soft delete by ID
  curl -X DELETE "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016" \
    -H "Authorization: Bearer {access_token}"

  # Hard delete
  curl -X DELETE "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016?hardDelete=true" \
    -H "Authorization: Bearer {access_token}"

  # Delete by name
  curl -X DELETE "{base_url}/api/v1/topics/name/sample_kafka.address_book" \
    -H "Authorization: Bearer {access_token}"

  # Restore soft-deleted topic
  curl -X PUT "{base_url}/api/v1/topics/restore" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{"id": "0a021819-982e-4ee4-a5a2-4af30eaa3016"}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response (Soft Delete) theme={null}
  {
    "id": "0a021819-982e-4ee4-a5a2-4af30eaa3016",
    "name": "address_book",
    "fullyQualifiedName": "sample_kafka.address_book",
    "description": "All Protobuf record related events gets captured in this topic",
    "version": 0.2,
    "updatedAt": 1769982663546,
    "updatedBy": "admin",
    "service": {
      "id": "469ef25e-9bdf-4d5f-8553-eb0ce8581f30",
      "type": "messagingService",
      "name": "sample_kafka",
      "fullyQualifiedName": "sample_kafka"
    },
    "serviceType": "Kafka",
    "messageSchema": {
      "schemaText": "syntax = \"proto2\";\npackage tutorial;\nmessage Person { ... }",
      "schemaType": "Protobuf"
    },
    "partitions": 1,
    "cleanupPolicies": ["delete"],
    "replicationFactor": 1,
    "deleted": true,
    "owners": [],
    "tags": [],
    "domains": []
  }
  ```
</ResponseExample>

***

## Returns

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

***

## Error Handling

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