# Delete a schema

This guide will demonstrate how to **delete** both a schema revision and an entire schema using the Control Plane user interface and API.

## User interface

It is possible to delete an individual revision, or an entire schema. Both actions an irreversible.

### Deleting a schema revision

To delete a single revision:

* In the schema's account, click on the Schema Registry tab.
* Find the schema, clicking on its **Name**.
* Find the schema revision by clicking on the appropriate version/revision from the table.
* Click on the **Actions** button once in the revision's page. ![schema-actions.png](/assets/images/schema-actions-03ad463435ed59b12a906bf7e67e6cdb.png)
* Click on the **Delete** button to remove the revision, or **Cancel** to go back. ![delete-revision.png](/assets/images/delete-revision-dfb15ba8233217d6f8ef39b83fa3158f.png)

Deleting a revision will take you back to the Schema Registry dashboard. The schema revision will now be permanently deleted from the Schema Registry Key Value bucket. However, all remaining schemas (assuming this was not the only revision within the schema) will remain.

### Delete an entire schema

This operation will delete all versions and revisions from the registry.

To delete the entire schema:

* Navigate the account where the schema exists and click on the **Schema Registry** tab.
* Click on the *three dots* in row of the schema to be deleted. ![schema-action-delete.png](/assets/images/schema-action-delete-76b236e6071d5d55a68f2fbadcafeef3.png)
* Click on the **Delete** button to remove the schema, or **Cancel** to go back. ![delete-schema.png](/assets/images/delete-schema-d1eea9886b2da5bb83617528ac665b85.png)

After clicking through the confirmation the schema will be removed and the page will refresh no longer showing the schema.

## NATS

Request subject: `$SR.v1.REMOVE.jsonschema.<version>.<revision>.<schema-name>`

Payload: `{}`

```
nats req '$SR.v1.REMOVE.jsonschema.1.2.Person' '{}'
```

## API

Access the Schema Registry API's requires an API token.

### Delete a single revision

```
curl https://${CONTROL_PLANE_URL}/api/schema-registry/alpha/${ACCOUNT_ID}/schemas/${SCHEMA_NAME}/${VERSION}.${REVISION}/${SCHEMA_FORMAT} \

  --request DELETE \

  --header 'authorization: Bearer ${TOKEN}' \

  --header 'content-type: application/json'
```

Ensure the correct **Version** and **Revision** is used as there is no confirmation and whatever subject is provided will be deleted.

A `204 No Content` will be returned

### Delete an entire schema

```
curl https://${CONTROL_PLANE_URL}/api/schema-registry/alpha/${ACCOUNT_ID}/schemas/${SCHEMA_NAME}/0.0/${SCHEMA_FORMAT} \

  --request DELETE \

  --header 'authorization: Bearer ${TOKEN}' \

  --header 'content-type: application/json'
```

**NOTE:** Instead of using the version or revision number of a single schema we provide `0.0` explicitly - meaning version `0` and revision `0`. This is used in place of subject wildcards (`*`).

Again, no confirmation is provided so be sure this is the correct schema you wish to delete.

A `204 No Content` will be returned

Refer to the API documentation for more information. For Control Plane this will be [https://${CONTROL_PLANE_URL}/api-docs](https://$%7BCONTROL_PLANE_URL%7D/api-docs)
