Documentation

Delete data

Use the influx CLI or the InfluxDB API /delete endpoint to delete data.

The -p, --predicate flag is supported in InfluxDB Cloud and InfluxDB OSS 2.0 beta 16 or earlier.

In InfluxDB OSS 2.0rc, the influx delete --predicate flag has been disabled.

Delete data using the influx CLI

  1. Use the influx delete command to delete points from InfluxDB.
  2. Specify your organization, bucket, and authentication token.
  3. Define the time range to delete data from with the --start and --stop flags.
  4. (InfluxDB Cloud only) Specify which points to delete using the predicate parameter and delete predicate syntax.

Example delete commands

InfluxDB OSS 2.0rc does not support the predicate parameter.

Delete data in InfluxDB Cloud

influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \
 --start '1970-01-01T00:00:00.00Z' \
 --stop '2020-01-01T00:00:00.00Z' \
 --predicate '_measurement="sensors" and sensorID="abc123"'

Delete data in InfluxDB OSS

influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \
 --start '1970-01-01T00:00:00.00Z' \
 --stop '2020-01-01T00:00:00.00Z' \

Running influx delete without the -p or --predicate flag deletes all data with timestamps between the specified --start and --stop times in the specified bucket.

Delete data using the API

The influx CLI is installed with InfluxDB OSS. If you’re using InfluxDB Cloud and haven’t already, download the influx CLI.

  1. Use the InfluxDB API /delete endpoint to delete points from InfluxDB.
  2. Include your organization and bucket as query parameters in the request URL.
  3. Use the Authorization header to provide your InfluxDB authentication token.
  4. In your request payload, define the time range to delete data from with start and stop.
  5. (InfluxDB Cloud only): Specify which points to delete using the predicate parameter and Delete predicate syntax.

Example delete requests

InfluxDB OSS 2.0rc does not support the predicate parameter.

Delete data in InfluxDB Cloud

curl --request POST \
  https://us-west-2-1.aws.cloud2.influxdata.com/api/v2/delete?orgID=<ORGID> \
  --header 'Authorization: Token <TOKEN WITH WRITE PERMISSIONS' \
  --header 'Content-Type: application/json' \
  --data '{
  "predicate": "_measurement=\"<MEASUREMENT NAME>\" and _field=\"<FIELD>\"",
  "start": "2020-08-16T08:00:00Z",
  "stop": "2020-08-17T08:00:00Z"
   }'

Delete data in InfluxDB OSS

curl --request POST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \
  --header 'Authorization: Token <YOURAUTHTOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start": "1970-01-01T00:00:00.00Z",
  "stop": "2020-01-01T00:00:00.00Z"
  }'

For more information, see the /delete API documentation.

Using the /delete endpoint without a predicate deletes all data with timestamps between the specified start and stop times in the specified bucket.


New! Cloud or OSS?

InfluxDB OSS 2.0 release candidate

InfluxDB OSS v2.0.rc includes breaking changes that require a manual upgrade from all alpha and beta versions. For information, see:

Upgrade to InfluxDB OSS v2.0.rc