Skip to main content

Delete Data from a Decentralized Web Node

Before deleting from your Decentralized Web Node (DWN), be sure to check out our Quickstart guide to ensure you’ve properly imported the Web5 SDK. Additionally, make sure you’ve set up a DID before attempting to delete from a DWN.

Deleting from a DWN

The following snippet allows you to delete from your Web5 instance’s DWN:

// Create the record
const myRecord = await web5.dwn.records.create(myDid.id, {
author: myDid.id,
data: "Hello Web5",
message: {
dataFormat: 'text/plain',
},
});
// Delete the record
const deleteResult = await myRecord.record.delete();