docs-v2/content/influxdb/v2.0/write-data/delete-data.md

3.1 KiB

title list_title description menu weight influxdb/v2.0/tags related
Delete data Delete data Delete data in the InfluxDB CLI and API.
influxdb_2_0
name parent
Delete data Write data
106
delete
/influxdb/v2.0/reference/syntax/delete-predicate/
/influxdb/v2.0/reference/cli/influx/delete/

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

{{% note %}} The influx delete --predicate flag is currently disabled and will be re-enabled in an upcoming release. Deleting data without a predicate deletes all data in the specified bucket with timestamps between the specified start and stop times. {{% /note %}}

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.

Example

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' \

Delete data using the API

  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.

Example

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.