Delete key-value pairs
To delete a key-value pair, call the delete()
method on any KV namespace you have bound to your Worker code:
await env.NAMESPACE.delete(key);
Calling the delete()
method will remove the key and value from your KV namespace. As with any operations, it may take some time for the key to be deleted from various points in the Cloudflare global network.
This method returns a promise that you should await
on to verify successful deletion.
You can also delete key-value pairs from the command line with Wrangler or via the API.