keen-io

Delete only some events in Keen.io


I want a way to delete some events data(I have some set of filters) not entire event collection data. Is there a way to delete logging into the keen account.

I want to delete few events data by today not affecting others data


Solution

  • You can delete just some events from a data collection as shown here: https://keen.io/docs/api/#delete-events.

    I’d recommend running an extraction of the exact same query first (https://keen.io/docs/api/#extractions) to get a preview of what you’re about to delete. That way you’ll also have successfully created a backup of that data as well!

    Here's a sample CURL command for deletes - use filters to select the subset of events that you want to remove from your event collection. Of course, replace PROJECT_ID, COLLECTION_NAME, and MASTER_KEY placeholders with your own.

    $ curl “https://api.keen.io/3.0/projects/${PROJECT_ID}/events/${COLLECTION_NAME}?filters=%5B%7B%22property_name%22%3A%22${PROPERTY_NAME}%22%2C%22operator%22%3A%22${PROPERTY_OPERATOR}%22%2C%22property_value%22%3A%22${PROPERTY_VALUE}%22%7D%5D&timeframe=this_7_days” \
      -H “Authorization: ${MASTER_KEY}” \
      -X DELETE