Data I/O endpoints
/api/v2/deleteDelete data
Deletes data from a bucket.
Use this endpoint to delete points from a bucket in a specified time range.
InfluxDB Cloud
Does the following when you send a delete request:
- Validates the request and queues the delete.
- If queued, responds with success (HTTP
2xxstatus code); error otherwise. - Handles the delete asynchronously and reaches eventual consistency.
To ensure that InfluxDB Cloud handles writes and deletes in the order you request them,
wait for a success response (HTTP 2xx status code) before you send the next request.
Because writes and deletes are asynchronous, your change might not yet be readable when you receive the response.
InfluxDB OSS
- Validates the request, handles the delete synchronously, and then responds with success or failure.
Required permissions
write-bucketsorwrite-bucket BUCKET_ID.
BUCKET_ID is the ID of the destination bucket.
Rate limits (with InfluxDB Cloud)
write rate limits apply.
For more information, see limits and adjustable quotas.
Related guides
- Delete data
- Learn how to use delete predicate syntax.
- Learn how InfluxDB handles deleted tags and deleted fields.
Parameters
Query parameters
org
stringAn organization name or ID.
InfluxDB Cloud
- Doesn’t use the
orgparameter ororgIDparameter. - Deletes data from the bucket in the organization associated with the authorization (API token).
InfluxDB OSS
- Requires either the
orgparameter or theorgIDparameter. - Deletes data from the bucket in the specified organization.
- If you pass both
orgIDandorg, they must both be valid.
bucket
stringbucket and bucketID, bucketID takes precedence.orgID
stringAn organization ID.
InfluxDB Cloud
- Doesn’t use the
orgparameter ororgIDparameter. - Deletes data from the bucket in the organization associated with the authorization (API token).
InfluxDB OSS
- Requires either the
orgparameter or theorgIDparameter. - Deletes data from the bucket in the specified organization.
- If you pass both
orgIDandorg, they must both be valid.
bucketID
stringbucket and bucketID, bucketID takes precedence.Header parameters
Zap-Trace-Span
stringRequest body required
Time range parameters and an optional delete predicate expression.
To select points to delete within the specified time range, pass a
delete predicate expression in the predicate property of the request body.
If you don’t pass a predicate, InfluxDB deletes all data with timestamps
in the specified time range.
Related guides
- Delete data
- Learn how to use delete predicate syntax.
application/jsonpredicate
string"tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")"start
required
string <date-time>stop
required
string <date-time>curl --request POST \
"http://localhost:8086/api/v2/delete" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"predicate": "tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")",
"start": "START",
"stop": "STOP"
}'Responses
Success.
InfluxDB Cloud
- Validated and queued the request.
- Handles the delete asynchronously - the deletion might not have completed yet.
An HTTP 2xx status code acknowledges that the write or delete is queued.
To ensure that InfluxDB Cloud handles writes and deletes in the order you request them,
wait for a response before you send the next request.
Because writes are asynchronous, data might not yet be written when you receive the response.
InfluxDB OSS
- Deleted the data.
Bad request. The response body contains detail about the error.
InfluxDB OSS
- Returns this error if the
orgparameter ororgIDparameter doesn’t match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/queryQuery data
Retrieves data from buckets.
Use this endpoint to send a Flux query request and retrieve data from a bucket.
Rate limits (with InfluxDB Cloud)
read rate limits apply.
For more information, see limits and adjustable quotas.
Related guides
Parameters
Query parameters
org
stringAn organization name or ID.
InfluxDB Cloud
- Doesn’t use the
orgparameter ororgIDparameter. - Queries the bucket in the organization associated with the authorization (API token).
InfluxDB OSS
- Requires either the
orgparameter ororgIDparameter. - Queries the bucket in the specified organization.
orgID
stringAn organization ID.
InfluxDB Cloud
- Doesn’t use the
orgparameter ororgIDparameter. - Queries the bucket in the organization associated with the authorization (API token).
InfluxDB OSS
- Requires either the
orgparameter ororgIDparameter. - Queries the bucket in the specified organization.
Header parameters
Zap-Trace-Span
stringAccept-Encoding
stringgzip
, identityidentityContent-Type
stringapplication/json
, application/vnd.fluxRequest body
application/jsondialect
stringextern
stringnow
string <date-time>now in the query.
Default is the server now time.params
objectKey-value pairs passed as parameters during query execution.
To use parameters in your query, pass a query with params references (in dot notation)–for example:
query: "from(bucket: params.mybucket)\
|> range(start: params.rangeStart) |> limit(n:1)"and pass params with the key-value pairs–for example:
params: {
"mybucket": "environment",
"rangeStart": "-30d"
}During query execution, InfluxDB passes params to your script and substitutes the values.
Limitations
- If you use
params, you can’t useextern.
query
required
stringtype
stringfluxcurl --request POST \
"http://localhost:8086/api/v2/query" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"dialect": {},
"extern": {},
"now": "NOW",
"params": {},
"query": "QUERY",
"type": "flux"
}'Responses
Bad request. The response body contains detail about the error.
InfluxDB OSS
- Returns this error if the
orgparameter ororgIDparameter doesn’t match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringInfluxDB Cloud:
- returns this error if a read or write request exceeds your plan’s adjustable service quotas or if a delete request exceeds the maximum global limit
- returns
Retry-Afterheader that describes when to try the write again.
InfluxDB OSS:
- doesn’t return this error.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/tasksList tasks
Retrieves a list of tasks.
To limit which tasks are returned, pass query parameters in your request.
If no query parameters are passed, InfluxDB returns all tasks up to the default limit.
Related guide
Parameters
Query parameters
name
stringafter
stringuser
stringorg
stringorgID
stringstatus
stringactive
, inactivelimit
integerThe maximum number of tasks to return.
Default is 100.
The minimum is 1 and the maximum is 500.
To reduce the payload size, combine type=basic and limit (see Request samples).
For more information about the basic response, see the type parameter.
100type
stringbasic or system).
Default is system.
Specifies the level of detail for tasks in the response.
The default (system) response contains all the metadata properties for tasks.
To reduce the response size, pass basic to omit some task properties (flux, createdAt, updatedAt).basic
, systemHeader parameters
Zap-Trace-Span
stringcurl --request GET \
"http://localhost:8086/api/v2/tasks" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
links
stringtasks
object[]Unauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/tasksCreate a task
Creates a task and returns the task.
Related guides
Parameters
Header parameters
Zap-Trace-Span
stringRequest body required
application/jsondescription
stringflux
required
stringorg
stringorgID
stringstatus
stringcurl --request POST \
"http://localhost:8086/api/v2/tasks" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"description": "DESCRIPTION",
"flux": "FLUX",
"org": "ORG",
"orgID": "ORGID",
"status": "active"
}'Responses
tasks list with the task.authorizationID
stringAn authorization ID. Specifies the authorization used when the task communicates with the query engine.
To find an authorization ID, use the
GET /api/v2/authorizations endpoint to
list authorizations.
createdAt
string <date-time>cron
stringdescription
stringevery
string <duration>every also determines when the task first runs, depending on the specified time.flux
required
string <flux>id
required
stringlabels
stringlastRunError
stringlastRunStatus
stringfailed
, success
, canceledlatestCompleted
string <date-time>links
object{"labels":"/api/v2/tasks/1/labels","logs":"/api/v2/tasks/1/logs","members":"/api/v2/tasks/1/members","owners":"/api/v2/tasks/1/owners","runs":"/api/v2/tasks/1/runs","self":"/api/v2/tasks/1"}labels
stringlogs
stringmembers
stringowners
stringruns
stringself
stringname
required
stringoffset
string <duration>0 removes the offset.org
stringorgID
required
stringownerID
stringA user ID. Specifies the owner of the task.
To find a user ID, you can use the
GET /api/v2/users endpoint to
list users.
status
stringupdatedAt
string <date-time>Bad request. The response body contains detail about the error.
InfluxDB OSS
- Returns this error if an incorrect value is passed for
orgororgID.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/tasks/{taskID}Retrieve a task
Parameters
Path parameters
taskID
required
stringHeader parameters
Zap-Trace-Span
stringcurl --request GET \
"http://localhost:8086/api/v2/tasks/{taskID}" \
--header "Authorization: Bearer INFLUX_TOKEN"Responses
authorizationID
stringAn authorization ID. Specifies the authorization used when the task communicates with the query engine.
To find an authorization ID, use the
GET /api/v2/authorizations endpoint to
list authorizations.
createdAt
string <date-time>cron
stringdescription
stringevery
string <duration>every also determines when the task first runs, depending on the specified time.flux
required
string <flux>id
required
stringlabels
stringlastRunError
stringlastRunStatus
stringfailed
, success
, canceledlatestCompleted
string <date-time>links
object{"labels":"/api/v2/tasks/1/labels","logs":"/api/v2/tasks/1/logs","members":"/api/v2/tasks/1/members","owners":"/api/v2/tasks/1/owners","runs":"/api/v2/tasks/1/runs","self":"/api/v2/tasks/1"}labels
stringlogs
stringmembers
stringowners
stringruns
stringself
stringname
required
stringoffset
string <duration>0 removes the offset.org
stringorgID
required
stringownerID
stringA user ID. Specifies the owner of the task.
To find a user ID, you can use the
GET /api/v2/users endpoint to
list users.
status
stringupdatedAt
string <date-time>Bad request. The response body contains detail about the error.
InfluxDB OSS
- Returns this error if an incorrect value is passed in the
orgparameter ororgIDparameter.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/tasks/{taskID}/runsStart a task run, overriding the schedule
Schedules a task run to start immediately, ignoring scheduled runs.
Use this endpoint to manually start a task run. Scheduled runs will continue to run as scheduled. This may result in concurrently running tasks.
To retry a previous run (and avoid creating a new run),
use the POST /api/v2/tasks/{taskID}/runs/{runID}/retry endpoint.
Parameters
Path parameters
taskID
required
stringHeader parameters
Zap-Trace-Span
stringRequest body
application/jsonscheduledFor
string <date-time>now option.
Default is the server now time.curl --request POST \
"http://localhost:8086/api/v2/tasks/{taskID}/runs" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"scheduledFor": "SCHEDULEDFOR"
}'Responses
finishedAt
string <date-time>"2006-01-02T15:04:05.999999999Z07:00"flux
stringid
stringlinks
object{"retry":"/api/v2/tasks/1/runs/1/retry","self":"/api/v2/tasks/1/runs/1","task":"/api/v2/tasks/1"}retry
string <uri>self
string <uri>task
string <uri>log
object[]requestedAt
string <date-time>"2006-01-02T15:04:05.999999999Z07:00"scheduledFor
string <date-time>now option.startedAt
string <date-time>"2006-01-02T15:04:05.999999999Z07:00"status
stringscheduled
, started
, failed
, success
, canceledtaskID
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringcode
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
string/api/v2/writeWrite data
Writes data to a bucket.
Use this endpoint to send data in line protocol format to InfluxDB.
InfluxDB Cloud
Does the following when you send a write request:
- Validates the request and queues the write.
- If queued, responds with success (HTTP
2xxstatus code); error otherwise. - Handles the delete asynchronously and reaches eventual consistency.
To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, wait for a success response (HTTP
2xxstatus code) before you send the next request.Because writes and deletes are asynchronous, your change might not yet be readable when you receive the response.
InfluxDB OSS
- Validates the request and handles the write synchronously.
- If all points were written successfully, responds with HTTP
2xxstatus code; otherwise, returns the first line that failed.
Required permissions
write-bucketsorwrite-bucket BUCKET_ID.
BUCKET_ID is the ID of the destination bucket.
Rate limits (with InfluxDB Cloud)
write rate limits apply.
For more information, see limits and adjustable quotas.
Related guides
Parameters
Query parameters
org
required
stringAn organization name or ID.
InfluxDB Cloud
- Doesn’t use the
orgparameter ororgIDparameter. - Writes data to the bucket in the organization associated with the authorization (API token).
InfluxDB OSS
- Requires either the
orgparameter or theorgIDparameter. - If you pass both
orgIDandorg, they must both be valid. - Writes data to the bucket in the specified organization.
orgID
stringAn organization ID.
InfluxDB Cloud
- Doesn’t use the
orgparameter ororgIDparameter. - Writes data to the bucket in the organization associated with the authorization (API token).
InfluxDB OSS
- Requires either the
orgparameter or theorgIDparameter. - If you pass both
orgIDandorg, they must both be valid. - Writes data to the bucket in the specified organization.
bucket
required
stringprecision
stringHeader parameters
Zap-Trace-Span
stringContent-Encoding
stringContent-Encoding: gzip header.gzip
, identityidentityContent-Type
stringContent-Type: text/plain; charset=utf-8.text/plain
, text/plain; charset=utf-8text/plain; charset=utf-8Content-Length
integermax body configuration option,
the server responds with status code 413.Accept
stringThe content type that the client can understand. Writes only return a response body if they fail–for example, due to a formatting problem or quota limit.
InfluxDB Cloud
- Returns only
application/jsonfor format and limit errors. - Returns only
text/htmlfor some quota limit errors.
InfluxDB OSS
- Returns only
application/jsonfor format and limit errors.
Related guides
application/jsonapplication/jsonRequest body required
In the request body, provide data in line protocol format.
To send compressed data, do the following:
- Use GZIP to compress the line protocol data.
- In your request, send the compressed data and the
Content-Encoding: gzipheader.
Related guides
application/jsoncurl --request POST \
"http://localhost:8086/api/v2/write?org=ORG&bucket=BUCKET" \
--header "Authorization: Bearer INFLUX_TOKEN" \
--header "Content-Type: text/plain" \
--data-raw 'airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000'Responses
Success.
InfluxDB Cloud
- Validated and queued the request.
- Handles the write asynchronously - the write might not have completed yet.
InfluxDB OSS
- Successfully wrote all points in the batch.
Related guides
Bad request. The response body contains detail about the error.
InfluxDB returns this error if the line protocol data in the request is malformed.
The response body contains the first malformed line in the data, and indicates what was expected.
For partial writes, the number of points written and the number of points rejected are also included.
For more information, check the rejected_points measurement in your _monitoring bucket.
InfluxDB Cloud
- Returns this error for bucket schema conflicts.
InfluxDB OSS
- Returns this error if the
orgparameter ororgIDparameter doesn’t match an organization.
code
required
stringinternal error
, not found
, conflict
, invalid
, empty value
, unavailableerr
stringline
integer <int32>message
stringop
stringUnauthorized. The error may indicate one of the following:
- The
Authorization: Tokenheader is missing or malformed. - The API token value is missing from the header.
- The token doesn’t have sufficient permissions to write to this organization and bucket.
code
stringunauthorized.unauthorizedmessage
stringNot found. A requested resource was not found. The response body contains the requested resource type and the name value (if you passed it)–for example:
"organization name \"my-org\" not found""organization not found": indicates you passed an ID that did not match an organization.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringThe request payload is too large. InfluxDB rejected the batch and did not write any data.
InfluxDB Cloud:
- Returns this error if the payload exceeds the 50MB size limit.
- Returns
Content-Type: text/htmlfor this error.
InfluxDB OSS:
- Returns this error only if the Go (golang)
ioutil.ReadAll()function raises an error. - Returns
Content-Type: application/jsonfor this error.
code
required
stringinvalidmessage
required
stringToo many requests.
InfluxDB Cloud
- Returns this error if a read or write request exceeds your plan’s adjustable service quotas or if a delete request exceeds the maximum global limit.
- For rate limits that reset automatically, returns a
Retry-Afterheader that describes when to try the write again. - For limits that can’t reset (for example, cardinality limit), doesn’t return a
Retry-Afterheader.
Rates (data-in (writes), queries (reads), and deletes) accrue within a fixed five-minute window. Once a rate limit is exceeded, InfluxDB returns an error response until the current five-minute window resets.
InfluxDB OSS
- Doesn’t return this error.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringService unavailable.
- Returns this error if the server is temporarily unavailable to accept writes.
- Returns a
Retry-Afterheader that describes when to try the write again.
code
required
stringinternal error
, not implemented
, not found
, conflict
, invalid
, unprocessable entity
, empty value
, unavailable
, forbidden
, too many requests
, unauthorized
, method not allowed
, request too large
, unsupported media typeerr
stringmessage
stringop
stringWas this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB OSS v2 and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.