---
title: Delete data
description: Use the influx CLI or the InfluxDB API /api/v2/delete endpoint to delete data from an InfluxDB bucket.
url: https://docs.influxdata.com/influxdb/v2/write-data/delete-data/
estimated_tokens: 2520
product: InfluxDB OSS v2
version: v2
---

# Delete data

This page documents an earlier version of InfluxDB OSS. [InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — **capture any plaintext tokens you still need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the InfluxDB API [`/api/v2/delete`](/influxdb/v2/api/delete/) endpoint to delete data from an InfluxDB bucket.

-   [Delete data using the influx CLI](#delete-data-using-the-influx-cli)
-   [Delete data using the API](#delete-data-using-the-api)

InfluxDB 2.9 supports deleting data by the following:

-   time range
-   measurement (`_measurement`)
-   tag

#### Cannot delete data by field

InfluxDB 2.9 does not support deleting data **by field**.

Once a delete request completes successfully, the deleted data is no longer queryable, but will remain on disk until the compaction service runs.

## Delete data using the influx CLI

Use [InfluxDB CLI connection configurations](/influxdb/v2/reference/cli/influx/config/) to provide your **InfluxDB host, organization, and API token**.

1. Use the [`influx delete` command](/influxdb/v2/reference/cli/influx/delete/) to delete points from InfluxDB.
    
2. Use the `--bucket` flag to specify which bucket to delete data from.
    
3. Use the `--start` and `--stop` flags to define the time range to delete data from. Use [RFC3339 timestamps](/influxdb/v2/reference/glossary/#rfc3339-timestamp).
    
4. *(Optional)* Use the `-p`, `--predicate` flag to include a [delete predicate](/influxdb/v2/reference/syntax/delete-predicate) that identifies which points to delete.
    
    Deleting data without a [delete predicate](/influxdb/v2/reference/syntax/delete-predicate) deletes all data in the specified bucket with timestamps between the specified `start` and `stop` times.
    

### Examples

-   [Delete points in a specific measurement with a specific tag value](#delete-points-in-a-specific-measurement-with-a-specific-tag-value)
-   [Delete all points in a specified time range](#delete-all-points-in-a-specified-time-range)

##### Delete points in a specific measurement with a specific tag value

```sh
influx delete --bucket example-bucket \
  --start '1970-01-01T00:00:00Z' \
  --stop $(date -u +"%Y-%m-%dT%H:%M:%SZ") \
  --predicate '_measurement="example-measurement" AND exampleTag="exampleTagValue"'
```

##### Delete all points in a specified time range

```sh
influx delete --bucket example-bucket \
  --start 2020-03-01T00:00:00Z \
  --stop 2020-11-14T00:00:00Z
```

## Delete data using the API

Use the InfluxDB API [`/api/v2/delete` endpoint](/influxdb/v2/api/delete/) to delete points from InfluxDB.

[POST http://localhost:8086/api/v2/delete](/influxdb/v2/api/delete/)

Include the following:

-   **Request method:** `POST`
-   **Headers:**
    -   **Authorization:** `Token` schema with your InfluxDB API token
    -   **Content-type:** `application/json`
-   **Query parameters:**
    -   **org** or **orgID:** organization name or [organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
    -   **bucket** or **bucketID:** bucket name or [bucket ID](/influxdb/v2/admin/buckets/view-buckets/)
-   **Request body:** JSON object with the following fields:  
    \* Required
    -   \* **start:** earliest time to delete data from ([RFC3339](/influxdb/v2/reference/glossary/#rfc3339-timestamp))
        
    -   \* **stop:** latest time to delete data from ([RFC3339](/influxdb/v2/reference/glossary/#rfc3339-timestamp))
        
    -   **predicate:** [delete predicate](/influxdb/v2/reference/syntax/delete-predicate) statement
        
        Deleting data without a [delete predicate](/influxdb/v2/reference/syntax/delete-predicate) deletes all data in the specified bucket with timestamps between the specified `start` and `stop` times.
        

### Examples

-   [Delete points in a specific measurement with a specific tag value](#delete-points-in-a-specific-measurement-with-a-specific-tag-value-1)
-   [Delete all points in a specified time range](#delete-all-points-in-a-specified-time-range-1)

##### Delete points in a specific measurement with a specific tag value

```sh
curl --request POST http://localhost:8086/api/v2/delete?org=example-org&bucket=example-bucket \
  --header 'Authorization: Token YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "start": "2020-03-01T00:00:00Z",
    "stop": "2020-11-14T00:00:00Z",
    "predicate": "_measurement=\"example-measurement\" AND exampleTag=\"exampleTagValue\""
  }'
```

##### Delete all points in a specified time range

```sh
curl --request POST http://localhost:8086/api/v2/delete?org=example-org&bucket=example-bucket \
  --header 'Authorization: Token YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "start": "2020-03-01T00:00:00Z",
    "stop": "2020-11-14T00:00:00Z"
  }'
```

*For more information, see the [`/api/v2/delete` endpoint documentation](/influxdb/v2/api/delete/).*

To delete a bucket see [Delete a bucket](/influxdb/v2/admin/buckets/delete-bucket/).

#### Related

-   [Delete predicate syntax](/influxdb/v2/reference/syntax/delete-predicate/)
-   [influx delete](/influxdb/v2/reference/cli/influx/delete/)
-   [Delete a bucket](/influxdb/v2/admin/buckets/delete-bucket/)

[delete](/influxdb/v2/tags/delete/)
