---
title: Data I/O endpoints
description: API reference for Data I/O endpoints
url: https://docs.influxdata.com/influxdb/cloud/api/data-i-o-endpoints/
estimated_tokens: 15214
product: InfluxDB Cloud (TSM)
version: cloud
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/cloud/api/data-i-o-endpoints/
---

[Download InfluxDB Cloud (TSM) API Spec](/openapi/influxdb-cloud-v2-api.yml)

POST`/api/v2/delete`

### Delete 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:

  1. Validates the request and queues the delete.
  2. If queued, responds with *success* (HTTP `2xx` status code); *error* otherwise.
  3. 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-buckets` or `write-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](/influxdb/cloud/account-management/limits/).

#### Related guides

* [Delete data](/influxdb/cloud/write-data/delete-data/)
* Learn how to use [delete predicate syntax](/influxdb/cloud/reference/syntax/delete-predicate/).
* Learn how InfluxDB handles [deleted tags](/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementtagkeys/)and [deleted fields](/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementfieldkeys/).

#### Parameters

##### Query parameters

`org`string

An organization name or ID.

#### InfluxDB Cloud

* Doesn’t use the `org` parameter or `orgID` parameter.
* Deletes data from the bucket in the organization
  associated with the authorization (API token).

#### InfluxDB OSS

* Requires either the `org` parameter or the `orgID` parameter.
* Deletes data from the bucket in the specified organization.
* If you pass both `orgID` and `org`, they must both be valid.

`bucket`string

A bucket name or ID.
Specifies the bucket to delete data from.
If you pass both `bucket` and `bucketID`, `bucketID` takes precedence.

`orgID`string

An organization ID.

#### InfluxDB Cloud

* Doesn’t use the `org` parameter or `orgID` parameter.
* Deletes data from the bucket in the organization
  associated with the authorization (API token).

#### InfluxDB OSS

* Requires either the `org` parameter or the `orgID` parameter.
* Deletes data from the bucket in the specified organization.
* If you pass both `orgID` and `org`, they must both be valid.

`bucketID`string

A bucket ID.
Specifies the bucket to delete data from.
If you pass both `bucket` and `bucketID`, `bucketID` takes precedence.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

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](/influxdb/cloud/write-data/delete-data/)
* Learn how to use [delete predicate syntax](/influxdb/cloud/reference/syntax/delete-predicate/).

Content-Type:`application/json`

`predicate`string

An expression in [delete predicate syntax](/influxdb/cloud/reference/syntax/delete-predicate/).

Example:`"tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")"`

`start`requiredstring \<date-time\>

A timestamp ([RFC3339 date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)).
The earliest time to delete from.

`stop`requiredstring \<date-time\>

A timestamp ([RFC3339 date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)).
The latest time to delete from.

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/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

204

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.

400

Bad request.
The response body contains detail about the error.

#### InfluxDB OSS

* Returns this error if the `org` parameter or `orgID` parameter doesn’t match an organization.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

404

Not 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`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

POST`/api/v2/query`

### Query 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](/influxdb/cloud/account-management/limits/).

#### Related guides

* [Query with the InfluxDB API](/influxdb/cloud/query-data/execute-queries/influx-api/)
* [Get started with Flux](/flux/v0.x/get-started/)

#### Parameters

##### Query parameters

`org`string

An organization name or ID.

#### InfluxDB Cloud

* Doesn’t use the `org` parameter or `orgID` parameter.
* Queries the bucket in the organization associated with the authorization (API token).

#### InfluxDB OSS

* Requires either the `org` parameter or `orgID` parameter.
* Queries the bucket in the specified organization.

`orgID`string

An organization ID.

#### InfluxDB Cloud

* Doesn’t use the `org` parameter or `orgID` parameter.
* Queries the bucket in the organization associated with the authorization (API token).

#### InfluxDB OSS

* Requires either the `org` parameter or `orgID` parameter.
* Queries the bucket in the specified organization.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

`Accept-Encoding`string

The content encoding (usually a compression algorithm) that the client can understand.

Allowed values:`gzip`, `identity`

Default:`identity`

`Content-Type`string

Allowed values:`application/json`, `application/vnd.flux`

#### Request body

Flux query or specification to execute

Content-Type:`application/json`

`dialect`string

`extern`string

`now`string \<date-time\>

Specifies the time that should be reported as `now` in the query.
Default is the server `now` time.

`params`object

Key-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 use *`extern`*.

`query`requiredstring

The query script to execute.

`type`string

The type of query. Must be “flux”.

Allowed:`flux`

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/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

200Success. The response body contains query results.

400

Bad request.
The response body contains detail about the error.

#### InfluxDB OSS

* Returns this error if the `org` parameter or `orgID` parameter doesn’t match an organization.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

404

Not 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`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

429

#### InfluxDB Cloud:

* returns this error if a **read** or **write** request exceeds your
  plan’s [adjustable service quotas](/influxdb/cloud/account-management/limits/#adjustable-service-quotas)or if a **delete** request exceeds the maximum[global limit](/influxdb/cloud/account-management/limits/#global-limits)
* returns `Retry-After` header that describes when to try the write again.

#### InfluxDB OSS:

* doesn’t return this error.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

GET`/api/v2/scripts`

### List scripts

Lists [scripts](/influxdb/cloud/api-guide/api-invokable-scripts/).

#### Related guides

* [Invoke custom scripts](/influxdb/cloud/api-guide/api-invokable-scripts/)

#### Parameters

##### Query parameters

`offset`integer

The offset for pagination.
The number of records to skip.

For more information about pagination parameters, see [Pagination](/influxdb/cloud/api/#tag/Pagination).

`limit`integer

The maximum number of scripts to return. Default is `100`.

Default:`100`

`name`string

The script name. Lists scripts with the specified name.

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/scripts" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200Success.
The response body contains the list of scripts.

`scripts`object[]

400Bad request.
InfluxDB is unable to parse the request.
The response body contains detail about the error.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultUnexpected error.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

GET`/api/v2/scripts/{scriptID}`

### Retrieve a script

Retrieves a [script](/influxdb/cloud/api-guide/api-invokable-scripts/).

#### Related Guides

* [Invoke custom scripts](/influxdb/cloud/api-guide/api-invokable-scripts/)

#### Parameters

##### Path parameters

`scriptID`requiredstring

A script ID.
Retrieves the specified script.

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/scripts/{scriptID}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200Success. The response body contains the script.

`createdAt`string \<date-time\>

`description`string

`id`string

`language`string

`name`requiredstring

`orgID`requiredstring

`script`requiredstring

The script to execute.

`updatedAt`string \<date-time\>

`url`string

The invocation endpoint address.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

404Not found.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

POST`/api/v2/scripts/{scriptID}/invoke`

### Invoke a script

Runs a script and returns the result.
When the script runs, InfluxDB replaces `params` keys referenced in the script with`params` key-values passed in the request body–for example:

The following sample script contains a *`mybucket`* parameter :

```json
"script": "from(bucket: params.mybucket)
            |> range(start: -7d)
            |> limit(n:1)"
```

The following example `POST /api/v2/scripts/SCRIPT_ID/invoke` request body
passes a value for the *`mybucket`* parameter:

```json
{
  "params": {
    "mybucket": "air_sensor"
  }
}
```

#### Related guides

* [Invoke custom scripts](/influxdb/cloud/api-guide/api-invokable-scripts/)

#### Parameters

##### Path parameters

`scriptID`requiredstring

A script ID.
Runs the specified script.

#### Request body

Content-Type:`application/json`

`params`object

The script parameters.`params` contains key-value pairs that map values to the **params.keys**in a script.
When you invoke a script with `params`, InfluxDB passes the values as
invocation parameters to the script.

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/scripts/{scriptID}/invoke" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "params": {}
}'
```

#### Responses

200Success.
The response body contains the result of the script execution.

400Bad request.
InfluxDB is unable to parse the request.
The response body contains detail about the error.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

404Not found.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultUnexpected error.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

GET`/api/v2/tasks`

### List all tasks

Retrieves a list of [tasks](/influxdb/cloud/reference/glossary/#task).

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`.

#### Parameters

##### Query parameters

`name`string

A [task](/influxdb/cloud/reference/glossary/#task) name.
Only returns tasks with the specified name.
Different tasks may have the same name.

`after`string

A [task](/influxdb/cloud/reference/glossary/#task) ID.
Only returns tasks created after the specified task.

`user`string

A [user](/influxdb/cloud/reference/glossary/#user) ID.
Only returns tasks owned by the specified user.

`org`string

An [organization](/influxdb/cloud/reference/glossary/#organization) name.
Only returns tasks owned by the specified organization.

`orgID`string

An [organization](/influxdb/cloud/reference/glossary/#organization) ID.
Only returns tasks owned by the specified organization.

`status`string

A [task](/influxdb/cloud/reference/glossary/#task) status.
Only returns tasks that have the specified status (`active` or `inactive`).

Allowed values:`active`, `inactive`

`limit`integer

The maximum number of [tasks](/influxdb/cloud/reference/glossary/#task) 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.

Default:`100`

`offset`integer

The number of records to skip.

`sortBy`string

The sort field. Only `name` is supported.
Specifies the field used to sort records in the list.

Allowed values:`name`

`type`string

A [task](/influxdb/cloud/reference/glossary/#task) type (`basic` 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`).

Allowed values:`basic`, `system`

`scriptID`string

A [script](#tag/Invokable-Scripts) ID.
Only returns tasks that use the specified invokable script.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/tasks" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200Success.
The response body contains the list of tasks.

`links`string

`tasks`object[]

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

POST`/api/v2/tasks`

### Create a task

Creates a [task](/influxdb/cloud/reference/glossary/#task) and returns the task.

Use this endpoint to create a scheduled task that runs a Flux script.

#### InfluxDB Cloud

* You can use either `flux` or `scriptID` to provide the task script.

  * `flux`: a string of “raw” Flux that contains task options and the script–for example:

    ```
    {
      "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\
      from(bucket: \"telegraf\")
        |> range(start: -1h)
        |> filter(fn: (r) => (r._measurement == \"cpu\"))
        |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))
        |> filter(fn: (r) => (r.cpu == \"cpu-total\"))
        |> aggregateWindow(every: 1h, fn: max)
        |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")",
      "status": "active",
      "description": "This task downsamples CPU data every hour"
    }
    ```

  * `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts)for the task to run.
    To pass task options when using `scriptID`, pass the options as
    properties in the request body–for example:

    ```
    {
      "name": "CPU Total 1 Hour New",
      "description": "This task downsamples CPU data every hour",
      "every": "1h",
      "scriptID": "SCRIPT_ID",
      "scriptParameters":
        {
          "rangeStart": "-1h",
          "bucket": "telegraf",
          "filterField": "cpu-total"
        }
      }
    ```

#### Limitations:

* You can’t use `flux` and `scriptID` for the same task.

#### Related guides

* [Get started with tasks](/influxdb/cloud/process-data/get-started/)
* [Create a task](/influxdb/cloud/process-data/manage-tasks/create-task/)
* [Common tasks](/influxdb/cloud/process-data/common-tasks/)
* [Task configuration options](/influxdb/cloud/process-data/task-options/)

#### Parameters

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

The task to create

Content-Type:`application/json`

`cron`string

A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time.

`description`string

The description of the task.

`every`string

The interval ([duration literal](/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs.`every` also determines when the task first runs, depending on the specified time.

`flux`string

The Flux script that the task runs.

#### Limitations

* If you use the `flux` property, you can’t use the `scriptID` and `scriptParameters` properties.

`name`string

The name of the task

`offset`string \<duration\>

A [duration](/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.

`org`string

The name of the organization that owns the task.

`orgID`string

The ID of the organization that owns the task.

`scriptID`string

The ID of the script that the task runs.

#### Limitations

* If you use the `scriptID` property, you can’t use the `flux` property.

`scriptParameters`object

The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run.

#### Limitations

* `scriptParameters` requires `scriptID`.
* If you use the `scriptID` and `scriptParameters` properties, you can’t use the `flux` property.

`status`string

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/tasks" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "cron": "CRON",
  "description": "DESCRIPTION",
  "every": "EVERY",
  "flux": "FLUX",
  "name": "NAME",
  "offset": "OFFSET",
  "org": "ORG",
  "orgID": "ORGID",
  "scriptID": "SCRIPTID",
  "scriptParameters": {},
  "status": "active"
}'
```

#### Responses

201Success. The response body contains a `tasks` list with the new task.

`authorizationID`string

An 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](#operation/GetAuthorizations) to
list authorizations.

`createdAt`string \<date-time\>

`cron`string

A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.

`description`string

A description of the task.

`every`string \<duration\>

The interval ([duration literal](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.

`flux`string \<flux\>

The Flux script that the task executes.

#### Limitations

* If you use the `flux` property, you can’t use the `scriptID` and `scriptParameters` properties.

`id`requiredstring

`labels`string

`lastRunError`string

`lastRunStatus`string

Allowed:`failed`, `success`, `canceled`

`latestCompleted`string \<date-time\>

A timestamp ([RFC3339 date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.

`links`object

Example:`{"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`string

`logs`string

`members`string

`owners`string

`runs`string

`self`string

`name`requiredstring

The name of the task.

`offset`string \<duration\>

A [duration](/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.

`org`string

An [organization](/influxdb/cloud/reference/glossary/#organization) name.
Specifies the organization that owns the task.

`orgID`requiredstring

An [organization](/influxdb/cloud/reference/glossary/#organization) ID.
Specifies the organization that owns the task.

`ownerID`string

A [user](/influxdb/cloud/reference/glossary/#user) ID.
Specifies the owner of the task.

To find a user ID, you can use the[`GET /api/v2/users` endpoint](#operation/GetUsers) to
list users.

`scriptID`string

A script ID.
Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes.

#### Limitations

* If you use the `scriptID` property, you can’t use the `flux` property.

#### Related guides

* [Create a task that references a script](/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script)

`scriptParameters`object

Key-value pairs for `params` in the script.
Defines the invocation parameter values passed to the script specified by `scriptID`.
When running the task, InfluxDB executes the script with the parameters
you provide.

#### Limitations

* To use `scriptParameters`, you must provide a `scriptID`.
* If you use the `scriptID` and `scriptParameters` properties, you can’t use the `flux` property.

`status`string

`updatedAt`string \<date-time\>

400

Bad request.
The response body contains detail about the error.

#### InfluxDB Cloud

* Returns this error if the task doesn’t contain one of *`flux`* or *`scriptID`*.
* Returns this error if the task contains *`flux`* *and* *`scriptID`*.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultUnexpected error

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

GET`/api/v2/tasks/{taskID}`

### Retrieve a task

Retrieves a [task](/influxdb/cloud/reference/glossary/#task).

#### Parameters

##### Path parameters

`taskID`requiredstring

A [task](/influxdb/cloud/reference/glossary/#task) ID.
Specifies the task to retrieve.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/tasks/{taskID}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200Success. The response body contains the task.

`authorizationID`string

An 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](#operation/GetAuthorizations) to
list authorizations.

`createdAt`string \<date-time\>

`cron`string

A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.

`description`string

A description of the task.

`every`string \<duration\>

The interval ([duration literal](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.

`flux`string \<flux\>

The Flux script that the task executes.

#### Limitations

* If you use the `flux` property, you can’t use the `scriptID` and `scriptParameters` properties.

`id`requiredstring

`labels`string

`lastRunError`string

`lastRunStatus`string

Allowed:`failed`, `success`, `canceled`

`latestCompleted`string \<date-time\>

A timestamp ([RFC3339 date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.

`links`object

Example:`{"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`string

`logs`string

`members`string

`owners`string

`runs`string

`self`string

`name`requiredstring

The name of the task.

`offset`string \<duration\>

A [duration](/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.

`org`string

An [organization](/influxdb/cloud/reference/glossary/#organization) name.
Specifies the organization that owns the task.

`orgID`requiredstring

An [organization](/influxdb/cloud/reference/glossary/#organization) ID.
Specifies the organization that owns the task.

`ownerID`string

A [user](/influxdb/cloud/reference/glossary/#user) ID.
Specifies the owner of the task.

To find a user ID, you can use the[`GET /api/v2/users` endpoint](#operation/GetUsers) to
list users.

`scriptID`string

A script ID.
Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes.

#### Limitations

* If you use the `scriptID` property, you can’t use the `flux` property.

#### Related guides

* [Create a task that references a script](/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script)

`scriptParameters`object

Key-value pairs for `params` in the script.
Defines the invocation parameter values passed to the script specified by `scriptID`.
When running the task, InfluxDB executes the script with the parameters
you provide.

#### Limitations

* To use `scriptParameters`, you must provide a `scriptID`.
* If you use the `scriptID` and `scriptParameters` properties, you can’t use the `flux` property.

`status`string

`updatedAt`string \<date-time\>

400

Bad request.
The response body contains detail about the error.

#### InfluxDB OSS

* Returns this error if an incorrect value is passed in the `org` parameter or `orgID` parameter.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

404

Not 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`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

POST`/api/v2/tasks/{taskID}/runs`

### Start 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](#operation/PostTasksIDRunsIDRetry).

#### Parameters

##### Path parameters

`taskID`requiredstring

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request body

Content-Type:`application/json`

`scheduledFor`string \<date-time\>

The time [RFC3339 date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp)used for the run’s `now` option.
Default is the server *now* time.

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/tasks/{taskID}/runs" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "scheduledFor": "SCHEDULEDFOR"
}'
```

#### Responses

201Success. The run is scheduled to start.

`finishedAt`string \<date-time\>

The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run finished executing.

Example:`"2006-01-02T15:04:05.999999999Z07:00"`

`flux`string

Flux used for the task

`id`string

`links`object

Example:`{"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[]

An array of logs associated with the run.

`requestedAt`string \<date-time\>

The time ([RFC3339Nano date/time format](/influxdb/cloud/reference/glossary/#rfc3339nano-timestamp)) the run was manually requested.

Example:`"2006-01-02T15:04:05.999999999Z07:00"`

`scheduledFor`string \<date-time\>

The time [RFC3339 date/time format](/influxdb/cloud/reference/glossary/#rfc3339-timestamp) used for the run’s `now` option.

`startedAt`string \<date-time\>

The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run started executing.

Example:`"2006-01-02T15:04:05.999999999Z07:00"`

`status`string

Allowed:`scheduled`, `started`, `failed`, `success`, `canceled`

`taskID`string

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

POST`/api/v2/write`

### Write data

Writes data to a bucket.

Use this endpoint to send data in [line protocol](/influxdb/cloud/reference/syntax/line-protocol/) format to InfluxDB.

#### InfluxDB Cloud

* Does the following when you send a write request:

  1. Validates the request and queues the write.
  2. If queued, responds with *success* (HTTP `2xx` status code); *error* otherwise.
  3. 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 and handles the write synchronously.
* If all points were written successfully, responds with HTTP `2xx` status code;
  otherwise, returns the first line that failed.

#### Required permissions

* `write-buckets` or `write-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](/influxdb/cloud/account-management/limits/).

#### Related guides

* [Write data with the InfluxDB API](/influxdb/cloud/write-data/developer-tools/api)
* [Optimize writes to InfluxDB](/influxdb/cloud/write-data/best-practices/optimize-writes/)
* [Troubleshoot issues writing data](/influxdb/cloud/write-data/troubleshoot/)

#### Parameters

##### Query parameters

`org`requiredstring

An organization name or ID.

#### InfluxDB Cloud

* Doesn’t use the `org` parameter or `orgID` parameter.
* Writes data to the bucket in the organization
  associated with the authorization (API token).

#### InfluxDB OSS

* Requires either the `org` parameter or the `orgID` parameter.
* If you pass both `orgID` and `org`, they must both be valid.
* Writes data to the bucket in the specified organization.

`orgID`string

An organization ID.

#### InfluxDB Cloud

* Doesn’t use the `org` parameter or `orgID` parameter.
* Writes data to the bucket in the organization
  associated with the authorization (API token).

#### InfluxDB OSS

* Requires either the `org` parameter or the `orgID` parameter.
* If you pass both `orgID` and `org`, they must both be valid.
* Writes data to the bucket in the specified organization.

`bucket`requiredstring

A bucket name or ID.
InfluxDB writes all points in the batch to the specified bucket.

`precision`string

The precision for unix timestamps in the line protocol batch.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

`Content-Encoding`string

The compression applied to the line protocol in the request payload.
To send a GZIP payload, pass `Content-Encoding: gzip` header.

Allowed values:`gzip`, `identity`

Default:`identity`

`Content-Type`string

The format of the data in the request body.
To send a line protocol payload, pass `Content-Type: text/plain; charset=utf-8`.

Allowed values:`text/plain`, `text/plain; charset=utf-8`

Default:`text/plain; charset=utf-8`

`Content-Length`integer

The size of the entity-body, in bytes, sent to InfluxDB.
If the length is greater than the `max body` configuration option,
the server responds with status code `413`.

`Accept`string

The 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/json` for format and limit errors.
* Returns only `text/html` for some quota limit errors.

#### InfluxDB OSS

* Returns only `application/json` for format and limit errors.

#### Related guides

* [Troubleshoot issues writing data](/influxdb/cloud/write-data/troubleshoot/)

Allowed values:`application/json`

Default:`application/json`

#### Request bodyrequired

In the request body, provide data in [line protocol format](/influxdb/cloud/reference/syntax/line-protocol/).

To send compressed data, do the following:

1. Use [GZIP](https://www.gzip.org/) to compress the line protocol data.
2. In your request, send the compressed data and the`Content-Encoding: gzip` header.

#### Related guides

* [Best practices for optimizing writes](/influxdb/cloud/write-data/best-practices/optimize-writes/)

Content-Type:`application/json`

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/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

204

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

* [How to check for write errors](/influxdb/cloud/write-data/troubleshoot/)

400

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 `org` parameter or `orgID` parameter doesn’t match an organization.

`code`requiredstring

Code is the machine-readable error code.

Allowed:`internal error`, `not found`, `conflict`, `invalid`, `empty value`, `unavailable`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`line`integer \<int32\>

First line in the request body that contains malformed data.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

401

Unauthorized. The error may indicate one of the following:

* The `Authorization: Token` header 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`string

The HTTP status code description. Default is `unauthorized`.

Allowed:`unauthorized`

`message`string

A human-readable message that may contain detail about the error.

404

Not 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`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

413

The 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/html` for this error.

#### InfluxDB OSS:

* Returns this error only if the [Go (golang) `ioutil.ReadAll()`](https://pkg.go.dev/io/ioutil#ReadAll) function raises an error.
* Returns `Content-Type: application/json` for this error.

`code`requiredstring

Code is the machine-readable error code.

Allowed:`invalid`

`message`requiredstring

Human-readable message.

429

Too many requests.

#### InfluxDB Cloud

* Returns this error if a **read** or **write** request exceeds your plan’s [adjustable service quotas](/influxdb/cloud/account-management/limits/#adjustable-service-quotas)or if a **delete** request exceeds the maximum [global limit](/influxdb/cloud/account-management/limits/#global-limits).
* For rate limits that reset automatically, returns a `Retry-After` header that describes when to try the write again.
* For limits that can’t reset (for example, **cardinality limit**), doesn’t return a `Retry-After` header.

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.

500Internal server error.
The server encountered an unexpected situation.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

503

Service unavailable.

* Returns this error if
  the server is temporarily unavailable to accept writes.
* Returns a `Retry-After` header that describes when to try the write again.

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal 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 type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.
