Delete a schema registry

Deleting a schema registry is an irreversible action. All subjects, schemas, and versions contained within the registry are permanently deleted. Ensure that no active Kafka clients rely on this registry before proceeding.

Required roles and permissions

To get the permissions that you need to delete a schema registry, ask your administrator to grant you the Managed Kafka Schema Registry Editor (roles/managedkafka.schemaRegistryEditor) IAM role on the schema registry instance. For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the permissions required to delete a schema registry. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to delete a schema registry:

  • Grant the following permission on the schema registry: managedkafka.schemaRegistries.delete
  • Grant the following permission for console users to list schema registries: managedkafka.schemaRegistries.list
  • Grant the following permission for console users to get schema registry details: managedkafka.schemaRegistries.get

You might also be able to get these permissions with custom roles or other predefined roles.

The higher-level Managed Kafka Schema Registry Admin (roles/managedkafka.schemaRegistryAdmin) role also includes these permissions.

For more information about the predefined roles available for Managed Service for Apache Kafka, see the Access control documentation.

Delete a schema registry

To permanently delete a schema registry and all its contents, follow these steps:

Console

  1. In the Google Cloud console, go to the Schema registries page.

    Go to schema registries

    A list of schema registries in your project is displayed.

  2. Click the name of the schema registry that you want to delete.
  3. On the Schema registry details page, click the Delete button.
  4. Confirm the deletion when prompted.

gcloud

  1. After installing the Google Cloud CLI, initialize it by running the following command:

    gcloud init

    If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  2. Use the gcloud beta managed-kafka schema-registries delete command:

    gcloud beta managed-kafka schema-registries delete SCHEMA_REGISTRY_ID \
        --location=LOCATION \

Replace the following:

  • SCHEMA_REGISTRY_ID (required): the ID of the schema registry you want to delete.
  • LOCATION (required): the Google Cloud region where the schema registry is located.

For example—to delete a schema registry named testRegistry in the us-central1 region, run the following command:

gcloud beta managed-kafka schema-registries delete testRegistry \
    --location=us-central1

API

Make a DELETE request to the specific resource URI of the schema registry you want to delete.

DELETE https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/SCHEMA_REGISTRY_ID

Replace the following:

  • PROJECT_ID (required): your Google Cloud project ID.
  • SCHEMA_REGISTRY_ID (required): the ID of the schema registry you want to delete.
  • LOCATION (required): the Google Cloud region where the schema registry is located.

If the request is successful and the schema registry is deleted, the API typically returns a 200 OK status code with an empty JSON body indicating the completion of a long-running operation or the operation resource itself.

If the specified schema registry does not exist, you receive a 404 Not Found error.

If you lack permissions, you receive a 403 Forbidden error.

What's next?

Apache Kafka® is a registered trademark of The Apache Software Foundation or its affiliates in the United States and/or other countries.