Skip to main content

Delete an object

Learn how to delete a personal data object

After adding an object, you may want to delete an object from a collection.

Delete an object from a collection

Overview

To delete an object in a collection you:

  1. Determine the ID of the object you want to delete.
  2. Use the CLI delete an object command or the REST API delete object by id operation passing the ID of the object.

Step-by-step

You want to delete the object with the ID ab3d5be0-ffde-4a8c-983a-f79dd5d34e17 in the buyers collection you created in Create a collection.

You request the deletion using either the CLI like this:

pvault object delete --collection buyers --id ab3d5be0-ffde-4a8c-983a-f79dd5d34e17

or REST API like this:

curl -s -X DELETE \
--url 'http://localhost:8123/api/pvlt/1.0/data/collections/buyers/objects/ab3d5be0-ffde-4a8c-983a-f79dd5d34e17?reason=AppFunctionality' \
-H 'Authorization: Bearer pvaultauth' \
-H 'Content-Type: application/json'

If the request is successful, you get a 200 response; there is no other output.