DELETE /v1/topics/{id}
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")
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");
# 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"}'
{
"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": []
}
Delete a Topic
Delete a topic by ID or name, with soft/hard delete options
DELETE
/
v1
/
topics
/
{id}
DELETE /v1/topics/{id}
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")
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");
# 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"}'
{
"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": []
}
Delete a Topic
Delete a topic by ID or fully qualified name. Supports soft delete (default), hard delete, and restore operations.Delete by ID
string
required
UUID of the topic to delete.
boolean
default:"false"
Recursively delete child entities.
boolean
default:"false"
Permanently delete the topic. If
false, the topic is soft-deleted and can be restored.Delete by Name
UseDELETE /v1/topics/name/{fqn} to delete by fully qualified name.
string
required
Fully qualified name of the topic (e.g.,
sample_kafka.address_book).boolean
default:"false"
Recursively delete child entities.
boolean
default:"false"
Permanently delete the topic.
Restore a Soft-Deleted Topic
UsePUT /v1/topics/restore to restore a soft-deleted topic.
string
required
UUID of the soft-deleted topic to restore.
DELETE /v1/topics/{id}
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")
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");
# 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"}'
{
"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": []
}
Returns
Soft delete returns the topic object withdeleted: 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 |
Was this page helpful?
⌘I