Delete rows in your table

Delete data in your tables using the DataStax Astra DB REST API.

You can delete rows in a table. Use the Delete rows endpoint to remove the rows in the table you created previously.

Delete data

To delete a row, send a DELETE request to /api/rest/v2/keyspaces/{keyspace_name}/{table_name}/{primaryKey}. For this example, the primary key consists of a partition key firstname and clustering column lastname, so we delete all data with Mookie/Betts:

curl -s -L -X DELETE https://$ASTRA_CLUSTER_ID-$ \
-H "Content-Type: application/json"

If you have a row where the primary key consists of multiple partition keys or multiple clustering columns, the {primaryKey} should be entered as {firstPartitionKey}/{secondPartitionKey}/{firstClusteringColumn}/{secondClusteringColumn} depending on the primary key definition. For instance, if we had defined the primary key as firstname/lastname and the clustering columns as user_id/age, the example above would have a {primaryKey} of Mookie/Betts/100/35.