# Best way to delete data

**URL:** <https://community.influxdata.com/t/best-way-to-delete-data/34052>\
**Category:** InfluxDB 2\
**Tags:** tasks\
**Created:** [April 26, 2024, 1:26pm UTC](https://community.influxdata.com/t/best-way-to-delete-data/34052 "2024-04-26T13:26:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreia\_pavan](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@andreia\_pavan](https://community.influxdata.com/u/andreia_pavan)\
**Post date:** [April 26, 2024, 1:26pm UTC](https://community.influxdata.com/t/best-way-to-delete-data/34052/1 "2024-04-26T13:26:46Z")

</div>

Hello everyone, I need to create a routine to delete data in a specific period.  
What is the best way to do this? Is it possible to do it with Tasks?  
Is there another way without using the bucket retention date?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [April 26, 2024, 8:12pm UTC](https://community.influxdata.com/t/best-way-to-delete-data/34052/2 "2024-04-26T20:12:25Z")

</div>

Hello @andreia_pavan,  
It depends what version are you using? Just want to verify. If it’s 2.x  
I recommend using the CLI.  
You’ll first have to install it and set up a CLI config.

> **[influx config create | InfluxDB OSS v2 Documentation](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/config/create/#Copyright)**
>
> The influx config create command creates a InfluxDB connection configuration.

Example of delteing all metrics within a time range:

> **[influx delete | InfluxDB OSS v2 Documentation](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/delete/#delete-all-points-within-a-specified-time-frame)**
>
> The influx delete command deletes points from an InfluxDB bucket.

---

<div class="post-metadata">

**Author:** ![andreia\_pavan](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@andreia\_pavan](https://community.influxdata.com/u/andreia_pavan)\
**Post date:** [April 29, 2024, 11:07am UTC](https://community.influxdata.com/t/best-way-to-delete-data/34052/3 "2024-04-29T11:07:12Z")

</div>

Hello @Anaisdg, thank you for your answer.  
I’m using version 2.x. Would it be possible to schedule within the Influx, as a task to schedule this delete execution?
