openapi: 3.0.0 info: title: InfluxDB Cloud API Service Authorizations (API tokens) Authorizations (API tokens) Data I/O endpoints API version: 2.0.1 description: 'The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. ' license: name: MIT url: https://opensource.org/licenses/MIT servers: - url: /api/v2 security: - TokenAuthentication: [] tags: - name: Data I/O endpoints paths: /write: post: operationId: PostWrite tags: - Data I/O endpoints summary: Write data description: "Writes data to a bucket.\n\nUse this endpoint to send data in [line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/) format to InfluxDB.\n\n#### InfluxDB Cloud\n\n- Does the following when you send a write request:\n\n 1. Validates the request and queues the write.\n 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise.\n 3. Handles the delete asynchronously and reaches eventual consistency.\n\n To ensure that InfluxDB Cloud handles writes and deletes in the order you request them,\n wait for a success response (HTTP `2xx` status code) before you send the next request.\n\n Because writes and deletes are asynchronous, your change might not yet be readable\n when you receive the response.\n\n#### InfluxDB OSS\n\n- Validates the request and handles the write synchronously.\n- If all points were written successfully, responds with HTTP `2xx` status code;\n otherwise, returns the first line that failed.\n\n#### Required permissions\n\n- `write-buckets` or `write-bucket BUCKET_ID`.\n\n *`BUCKET_ID`* is the ID of the destination bucket.\n\n#### Rate limits (with InfluxDB Cloud)\n\n`write` rate limits apply.\nFor more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/).\n\n#### Related guides\n\n- [Write data with the InfluxDB API](https://docs.influxdata.com/influxdb/cloud/write-data/developer-tools/api)\n- [Optimize writes to InfluxDB](https://docs.influxdata.com/influxdb/cloud/write-data/best-practices/optimize-writes/)\n- [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/cloud/write-data/troubleshoot/)\n" requestBody: description: "In the request body, provide data in [line protocol format](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/).\n\nTo send compressed data, do the following:\n\n 1. Use [GZIP](https://www.gzip.org/) to compress the line protocol data.\n 2. In your request, send the compressed data and the\n `Content-Encoding: gzip` header.\n\n#### Related guides\n\n- [Best practices for optimizing writes](https://docs.influxdata.com/influxdb/cloud/write-data/best-practices/optimize-writes/)\n" required: true content: text/plain: schema: type: string format: byte examples: plain-utf8: value: 'airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000 airSensors,sensor_id=TLM0202 temperature=75.30007505999716,humidity=35.651929918691714,co=0.5141876544505826 1630424257000000000 ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: header name: Content-Encoding description: 'The compression applied to the line protocol in the request payload. To send a GZIP payload, pass `Content-Encoding: gzip` header. ' schema: type: string description: 'Content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. ' default: identity enum: - gzip - identity - in: header name: Content-Type description: 'The format of the data in the request body. To send a line protocol payload, pass `Content-Type: text/plain; charset=utf-8`. ' schema: type: string description: '`text/plain` is the content type for line protocol. `UTF-8` is the default character set. ' default: text/plain; charset=utf-8 enum: - text/plain - text/plain; charset=utf-8 - in: header name: Content-Length description: '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`. ' schema: type: integer description: The length in decimal number of octets. - in: header name: Accept description: "The content type that the client can understand.\nWrites only return a response body if they fail--for example,\ndue to a formatting problem or quota limit.\n\n#### InfluxDB Cloud\n\n - Returns only `application/json` for format and limit errors.\n - Returns only `text/html` for some quota limit errors.\n\n#### InfluxDB OSS\n\n - Returns only `application/json` for format and limit errors.\n\n#### Related guides\n\n- [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/cloud/write-data/troubleshoot/)\n" schema: type: string description: Error content type. default: application/json enum: - application/json - in: query name: org description: "An organization name or ID.\n\n#### InfluxDB Cloud\n\n- Doesn't use the `org` parameter or `orgID` parameter.\n- Writes data to the bucket in the organization\n associated with the authorization (API token).\n\n#### InfluxDB OSS\n\n- Requires either the `org` parameter or the `orgID` parameter.\n- If you pass both `orgID` and `org`, they must both be valid.\n- Writes data to the bucket in the specified organization.\n" required: true schema: type: string description: The organization name or ID. - in: query name: orgID description: "An organization ID.\n\n#### InfluxDB Cloud\n\n- Doesn't use the `org` parameter or `orgID` parameter.\n- Writes data to the bucket in the organization\n associated with the authorization (API token).\n\n#### InfluxDB OSS\n\n- Requires either the `org` parameter or the `orgID` parameter.\n- If you pass both `orgID` and `org`, they must both be valid.\n- Writes data to the bucket in the specified organization.\n" schema: type: string - in: query name: bucket description: 'A bucket name or ID. InfluxDB writes all points in the batch to the specified bucket. ' required: true schema: type: string description: The bucket name or ID. - in: query name: precision description: The precision for unix timestamps in the line protocol batch. schema: $ref: '#/components/schemas/WritePrecision' responses: '204': description: '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](https://docs.influxdata.com/influxdb/cloud/write-data/troubleshoot/) ' '400': description: '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. ' content: application/json: schema: $ref: '#/components/schemas/LineProtocolError' examples: measurementSchemaFieldTypeConflict: summary: (Cloud) field type conflict thrown by an explicit bucket schema value: code: invalid message: 'partial write error (2 written): unable to parse ''air_sensor,service=S1,sensor=L1 temperature="90.5",humidity=70.0 1632850122'': schema: field type for field "temperature" not permitted by schema; got String but expected Float' orgNotFound: summary: (OSS) organization not found value: code: invalid message: 'failed to decode request body: organization not found' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '413': description: "The request payload is too large.\nInfluxDB rejected the batch and did not write any data.\n\n#### InfluxDB Cloud:\n\n - Returns this error if the payload exceeds the 50MB size limit.\n - Returns `Content-Type: text/html` for this error.\n\n#### InfluxDB OSS:\n\n - Returns this error only if the [Go (golang) `ioutil.ReadAll()`](https://pkg.go.dev/io/ioutil#ReadAll) function raises an error.\n - Returns `Content-Type: application/json` for this error.\n" content: application/json: schema: $ref: '#/components/schemas/LineProtocolLengthError' examples: dataExceedsSizeLimitOSS: summary: InfluxDB OSS response value: '{"code":"request too large","message":"unable to read data: points batch is too large"} ' text/html: schema: type: string examples: dataExceedsSizeLimit: summary: InfluxDB Cloud response value: "\n 413 Request Entity Too Large\n \n

413 Request Entity Too Large

\n
\n
nginx
\n \n\n" '429': description: "Too many requests.\n\n#### InfluxDB Cloud\n\n - Returns this error if a **read** or **write** request exceeds your plan's [adjustable service quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/#adjustable-service-quotas)\n or if a **delete** request exceeds the maximum [global limit](https://docs.influxdata.com/influxdb/cloud/account-management/limits/#global-limits).\n - For rate limits that reset automatically, returns a `Retry-After` header that describes when to try the write again.\n - For limits that can't reset (for example, **cardinality limit**), doesn't return a `Retry-After` header.\n\n Rates (data-in (writes), queries (reads), and deletes) accrue within a fixed five-minute window.\n Once a rate limit is exceeded, InfluxDB returns an error response until the current five-minute window resets.\n\n#### InfluxDB OSS\n\n - Doesn't return this error.\n" headers: Retry-After: description: Non-negative decimal integer indicating seconds to wait before retrying the request. schema: type: integer format: int32 '500': $ref: '#/components/responses/InternalServerError' '503': description: "Service unavailable.\n\n- Returns this error if\n the server is temporarily unavailable to accept writes.\n- Returns a `Retry-After` header that describes when to try the write again.\n" headers: Retry-After: description: Non-negative decimal integer indicating seconds to wait before retrying the request. schema: type: integer format: int32 default: $ref: '#/components/responses/GeneralServerError' /delete: post: operationId: PostDelete tags: - Data I/O endpoints summary: Delete data description: "Deletes data from a bucket.\n\nUse this endpoint to delete points from a bucket in a specified time range.\n\n#### InfluxDB Cloud\n\n- Does the following when you send a delete request:\n\n 1. Validates the request and queues the delete.\n 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise.\n 3. Handles the delete asynchronously and reaches eventual consistency.\n\nTo ensure that InfluxDB Cloud handles writes and deletes in the order you request them,\nwait for a success response (HTTP `2xx` status code) before you send the next request.\n\nBecause writes and deletes are asynchronous, your change might not yet be readable\nwhen you receive the response.\n\n#### InfluxDB OSS\n\n- Validates the request, handles the delete synchronously,\n and then responds with success or failure.\n\n#### Required permissions\n\n- `write-buckets` or `write-bucket BUCKET_ID`.\n\n*`BUCKET_ID`* is the ID of the destination bucket.\n\n#### Rate limits (with InfluxDB Cloud)\n\n`write` rate limits apply.\nFor more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/).\n\n#### Related guides\n\n- [Delete data](https://docs.influxdata.com/influxdb/cloud/write-data/delete-data/)\n- Learn how to use [delete predicate syntax](https://docs.influxdata.com/influxdb/cloud/reference/syntax/delete-predicate/).\n- Learn how InfluxDB handles [deleted tags](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementtagkeys/)\n and [deleted fields](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementfieldkeys/).\n" x-codeSamples: - lang: Shell label: cURL source: "curl --request POST INFLUX_URL/api/v2/delete?org=INFLUX_ORG&bucket=INFLUX_BUCKET \\\n --header 'Authorization: Token INFLUX_API_TOKEN' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"start\": \"2020-03-01T00:00:00Z\",\n \"stop\": \"2020-11-14T00:00:00Z\",\n \"predicate\": \"tag1=\\\"value1\\\" and (tag2=\\\"value2\\\" and tag3!=\\\"value3\\\")\"\n }'\n" requestBody: description: '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](https://docs.influxdata.com/influxdb/cloud/write-data/delete-data/) - Learn how to use [delete predicate syntax](https://docs.influxdata.com/influxdb/cloud/reference/syntax/delete-predicate/). ' required: true content: application/json: schema: $ref: '#/components/schemas/DeletePredicateRequest' parameters: - $ref: '#/components/parameters/TraceSpan' - in: query name: org description: "An organization name or ID.\n\n#### InfluxDB Cloud\n\n- Doesn't use the `org` parameter or `orgID` parameter.\n- Deletes data from the bucket in the organization\n associated with the authorization (API token).\n\n#### InfluxDB OSS\n\n- Requires either the `org` parameter or the `orgID` parameter.\n- Deletes data from the bucket in the specified organization.\n- If you pass both `orgID` and `org`, they must both be valid.\n" schema: type: string description: The organization name or ID. - in: query name: bucket description: 'A bucket name or ID. Specifies the bucket to delete data from. If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. ' schema: type: string description: The bucket name or ID. - in: query name: orgID description: "An organization ID.\n\n#### InfluxDB Cloud\n\n- Doesn't use the `org` parameter or `orgID` parameter.\n- Deletes data from the bucket in the organization\n associated with the authorization (API token).\n\n#### InfluxDB OSS\n\n- Requires either the `org` parameter or the `orgID` parameter.\n- Deletes data from the bucket in the specified organization.\n- If you pass both `orgID` and `org`, they must both be valid.\n" schema: type: string description: The organization ID. - in: query name: bucketID description: 'A bucket ID. Specifies the bucket to delete data from. If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. ' schema: type: string description: The bucket ID. responses: '204': description: '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': description: '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. ' content: application/json: schema: $ref: '#/components/schemas/Error' examples: orgNotFound: summary: Organization not found value: code: invalid message: 'failed to decode request body: organization not found' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' /query: post: operationId: PostQuery tags: - Data I/O endpoints summary: Query data description: '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](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). #### Related guides - [Query with the InfluxDB API](https://docs.influxdata.com/influxdb/cloud/query-data/execute-queries/influx-api/) - [Get started with Flux](https://docs.influxdata.com/flux/v0.x/get-started/) ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: header name: Accept-Encoding description: The content encoding (usually a compression algorithm) that the client can understand. schema: type: string description: The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. default: identity enum: - gzip - identity - in: header name: Content-Type schema: type: string enum: - application/json - application/vnd.flux - in: query name: org description: '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. ' schema: type: string - in: query name: orgID description: '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. ' schema: type: string x-codeSamples: - lang: Shell label: cURL source: "curl --request POST 'INFLUX_URL/api/v2/query?org=INFLUX_ORG' \\\n--header 'Content-Type: application/vnd.flux' \\\n--header 'Accept: application/csv \\\n--header 'Authorization: Token INFLUX_API_TOKEN' \\\n--data 'from(bucket: \"example-bucket\")\n |> range(start: -5m)\n |> filter(fn: (r) => r._measurement == \"example-measurement\")'\n" requestBody: description: Flux query or specification to execute content: application/json: schema: $ref: '#/components/schemas/Query' application/vnd.flux: schema: type: string example: "from(bucket: \"example-bucket\")\n |> range(start: -5m)\n |> filter(fn: (r) => r._measurement == \"example-measurement\")\n" responses: '200': description: Success. The response body contains query results. headers: Content-Encoding: description: Lists encodings (usually compression algorithms) that have been applied to the response payload. schema: type: string description: 'The content coding: `gzip` for compressed data or `identity` for unmodified, uncompressed data. ' default: identity enum: - gzip - identity Trace-Id: description: The trace ID, if generated, of the request. schema: type: string description: Trace ID of a request. content: application/csv: schema: type: string example: 'result,table,_start,_stop,_time,region,host,_value mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62 ' '400': description: '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. ' content: application/json: schema: $ref: '#/components/schemas/Error' examples: orgNotFound: summary: Organization not found value: code: invalid message: 'failed to decode request body: organization not found' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '429': description: "#### InfluxDB Cloud:\n - returns this error if a **read** or **write** request exceeds your\n plan's [adjustable service quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/#adjustable-service-quotas)\n or if a **delete** request exceeds the maximum\n [global limit](https://docs.influxdata.com/influxdb/cloud/account-management/limits/#global-limits)\n - returns `Retry-After` header that describes when to try the write again.\n\n#### InfluxDB OSS:\n - doesn't return this error.\n" headers: Retry-After: description: Non-negative decimal integer indicating seconds to wait before retrying the request. schema: type: integer format: int32 '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' /tasks/{taskID}/runs: post: operationId: PostTasksIDRuns tags: - Data I/O endpoints summary: Start a task run, overriding the schedule description: '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: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true requestBody: content: application/json: schema: $ref: '#/components/schemas/RunManually' responses: '201': description: Success. The run is scheduled to start. content: application/json: schema: $ref: '#/components/schemas/Run' '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' /tasks: get: operationId: GetTasks tags: - Data I/O endpoints summary: List all tasks description: 'Retrieves a list of [tasks](https://docs.influxdata.com/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: - $ref: '#/components/parameters/TraceSpan' - in: query name: name description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) name. Only returns tasks with the specified name. Different tasks may have the same name. ' schema: type: string - in: query name: after schema: type: string description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. Only returns tasks created after the specified task. ' - in: query name: user schema: type: string description: 'A [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) ID. Only returns tasks owned by the specified user. ' - in: query name: org schema: type: string description: 'An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) name. Only returns tasks owned by the specified organization. ' - in: query name: orgID schema: type: string description: 'An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID. Only returns tasks owned by the specified organization. ' - in: query name: status schema: type: string enum: - active - inactive description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) status. Only returns tasks that have the specified status (`active` or `inactive`). ' - in: query name: limit schema: type: integer minimum: -1 maximum: 500 default: 100 description: 'The maximum number of [tasks](https://docs.influxdata.com/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. ' examples: minPaginated: summary: Return a maximum of 50 tasks. value: '50' all: summary: Return all tasks, without pagination. value: '-1' - in: query name: offset required: false schema: type: integer minimum: 0 default: 0 description: The number of records to skip. - in: query name: sortBy description: 'The sort field. Only `name` is supported. Specifies the field used to sort records in the list. ' required: false schema: type: string enum: - name - in: query name: type description: 'A [task](https://docs.influxdata.com/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`). ' required: false schema: default: '' type: string enum: - basic - system - in: query name: scriptID description: 'A [script](#tag/Invokable-Scripts) ID. Only returns tasks that use the specified invokable script. ' schema: type: string responses: '200': description: 'Success. The response body contains the list of tasks. ' content: application/json: schema: $ref: '#/components/schemas/Tasks' examples: basicTypeTaskOutput: summary: Basic output description: 'A sample response body for the `?type=basic` parameter. `type=basic` omits some task fields (`createdAt` and `updatedAt`) and field values (`org`, `flux`) in the response. ' value: links: self: /api/v2/tasks?limit=100 tasks: - links: labels: /api/v2/tasks/09956cbb6d378000/labels logs: /api/v2/tasks/09956cbb6d378000/logs members: /api/v2/tasks/09956cbb6d378000/members owners: /api/v2/tasks/09956cbb6d378000/owners runs: /api/v2/tasks/09956cbb6d378000/runs self: /api/v2/tasks/09956cbb6d378000 labels: [] id: 09956cbb6d378000 orgID: 48c88459ee424a04 org: '' ownerID: 0772396d1f411000 name: task1 status: active flux: '' every: 30m latestCompleted: '2022-06-30T15:00:00Z' lastRunStatus: success systemTypeTaskOutput: summary: System output description: 'A sample response body for the `?type=system` parameter. `type=system` returns all task fields. ' value: links: self: /api/v2/tasks?limit=100 tasks: - links: labels: /api/v2/tasks/09956cbb6d378000/labels logs: /api/v2/tasks/09956cbb6d378000/logs members: /api/v2/tasks/09956cbb6d378000/members owners: /api/v2/tasks/09956cbb6d378000/owners runs: /api/v2/tasks/09956cbb6d378000/runs self: /api/v2/tasks/09956cbb6d378000 labels: [] id: 09956cbb6d378000 orgID: 48c88459ee424a04 org: my-iot-center ownerID: 0772396d1f411000 name: task1 description: IoT Center 90-day environment average. status: active flux: "option task = {name: \"task1\", every: 30m}\n\nfrom(bucket: \"iot_center\")\n |> range(start: -90d)\n |> filter(fn: (r) => r._measurement == \"environment\")\n |> aggregateWindow(every: 1h, fn: mean)" every: 30m latestCompleted: '2022-06-30T15:00:00Z' lastRunStatus: success createdAt: '2022-06-27T15:09:06Z' updatedAt: '2022-06-28T18:10:15Z' '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' x-codeSamples: - lang: Shell label: 'cURL: all tasks, basic output' source: "curl INFLUX_URL/api/v2/tasks/?limit=-1&type=basic \\\n --header 'Content-Type: application/json' \\\n --header 'Authorization: Token INFLUX_API_TOKEN'\n" post: operationId: PostTasks tags: - Data I/O endpoints summary: Create a task description: "Creates a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and returns the task.\n\nUse this endpoint to create a scheduled task that runs a Flux script.\n\n#### InfluxDB Cloud\n\n- You can use either `flux` or `scriptID` to provide the task script.\n\n - `flux`: a string of \"raw\" Flux that contains task options and the script--for example:\n\n ```json\n {\n \"flux\": \"option task = {name: \\\"CPU Total 1 Hour New\\\", every: 1h}\\\n from(bucket: \\\"telegraf\\\")\n |> range(start: -1h)\n |> filter(fn: (r) => (r._measurement == \\\"cpu\\\"))\n |> filter(fn: (r) =>\\n\\t\\t(r._field == \\\"usage_system\\\"))\n |> filter(fn: (r) => (r.cpu == \\\"cpu-total\\\"))\n |> aggregateWindow(every: 1h, fn: max)\n |> to(bucket: \\\"cpu_usage_user_total_1h\\\", org: \\\"INFLUX_ORG\\\")\",\n \"status\": \"active\",\n \"description\": \"This task downsamples CPU data every hour\"\n }\n ```\n\n - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts)\n for the task to run.\n To pass task options when using `scriptID`, pass the options as\n properties in the request body--for example:\n\n ```json\n {\n \"name\": \"CPU Total 1 Hour New\",\n \"description\": \"This task downsamples CPU data every hour\",\n \"every\": \"1h\",\n \"scriptID\": \"SCRIPT_ID\",\n \"scriptParameters\":\n {\n \"rangeStart\": \"-1h\",\n \"bucket\": \"telegraf\",\n \"filterField\": \"cpu-total\"\n }\n }\n ```\n\n#### Limitations:\n\n- You can't use `flux` and `scriptID` for the same task.\n\n#### Related guides\n\n- [Get started with tasks](https://docs.influxdata.com/influxdb/cloud/process-data/get-started/)\n- [Create a task](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/)\n- [Common tasks](https://docs.influxdata.com/influxdb/cloud/process-data/common-tasks/)\n- [Task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/)\n" parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: description: The task to create required: true content: application/json: schema: $ref: '#/components/schemas/TaskCreateRequest' responses: '201': description: Success. The response body contains a `tasks` list with the new task. content: application/json: schema: $ref: '#/components/schemas/Task' '400': description: '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`_. ' content: application/json: schema: $ref: '#/components/schemas/Error' examples: fluxAndScriptError: summary: The request body can't contain both flux and scriptID value: code: invalid message: 'failed to decode request: can not provide both scriptID and flux' missingFluxError: summary: The request body requires either a flux parameter or scriptID parameter value: code: invalid message: 'failed to decode request: flux required' '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' x-codeSamples: - lang: Shell label: 'cURL: create a Flux script task' source: "curl INFLUX_URL/api/v2/tasks \\\n--header \"Content-type: application/json\" \\\n--header \"Authorization: Token INFLUX_API_TOKEN\" \\\n--data-binary @- << EOF\n {\n \"orgID\": \"INFLUX_ORG_ID\",\n \"description\": \"IoT Center 30d environment average.\",\n \"flux\": \"option task = {name: \\\"iot-center-task-1\\\", every: 30m}\\\n from(bucket: \\\"iot_center\\\")\\\n |> range(start: -30d)\\\n |> filter(fn: (r) => r._measurement == \\\"environment\\\")\\\n |> aggregateWindow(every: 1h, fn: mean)\"\n }\nEOF\n" - lang: Shell label: 'cURL: create a Flux script reference task' source: "curl INFLUX_URL/api/v2/tasks \\\n--header \"Content-type: application/json\" \\\n--header \"Authorization: Token INFLUX_API_TOKEN\" \\\n--data-binary @- << EOF\n {\n \"orgID\": \"INFLUX_ORG_ID\",\n \"description\": \"IoT Center 30d environment average.\",\n \"scriptID\": \"085138a111448000\",\n \"scriptParameters\":\n {\n \"rangeStart\": \"-30d\",\n \"bucket\": \"air_sensor\",\n \"filterField\": \"temperature\",\n \"groupColumn\": \"_time\"\n }\n }\nEOF\n" /tasks/{taskID}: get: operationId: GetTasksID tags: - Data I/O endpoints summary: Retrieve a task description: 'Retrieves a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. Specifies the task to retrieve. ' responses: '200': description: Success. The response body contains the task. content: application/json: schema: $ref: '#/components/schemas/Task' '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' components: responses: AuthorizationError: description: "Unauthorized. The error may indicate one of the following:\n\n * The `Authorization: Token` header is missing or malformed.\n * The API token value is missing from the header.\n * The token doesn't have sufficient permissions to write to this organization and bucket.\n" content: application/json: schema: properties: code: description: 'The HTTP status code description. Default is `unauthorized`. ' readOnly: true type: string enum: - unauthorized message: readOnly: true description: A human-readable message that may contain detail about the error. type: string examples: tokenNotAuthorized: summary: Token is not authorized to access a resource value: code: unauthorized message: unauthorized access InternalServerError: description: 'Internal server error. The server encountered an unexpected situation. ' content: application/json: schema: $ref: '#/components/schemas/Error' GeneralServerError: description: Non 2XX error response from server. content: application/json: schema: $ref: '#/components/schemas/Error' ResourceNotFoundError: description: "Not found.\nA requested resource was not found.\nThe response body contains the requested resource type and the name value\n(if you passed it)--for example:\n\n- `\"organization name \\\"my-org\\\" not found\"`\n- `\"organization not found\"`: indicates you passed an ID that did not match\n an organization.\n" content: application/json: schema: $ref: '#/components/schemas/Error' examples: org-not-found: summary: Organization name not found value: code: not found message: organization name "my-org" not found bucket-not-found: summary: Bucket name not found value: code: not found message: bucket "air_sensor" not found orgID-not-found: summary: Organization ID not found value: code: not found message: organization not found BadRequestError: description: '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. ' content: application/json: schema: $ref: '#/components/schemas/Error' examples: orgProvidedNotFound: summary: The org or orgID passed doesn't own the token passed in the header value: code: invalid message: 'failed to decode request body: organization not found' schemas: LogEvent: type: object properties: time: readOnly: true description: The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339nano-timestamp)) that the event occurred. type: string format: date-time example: 2006-01-02T15:04:05.999999999Z07:00 message: readOnly: true description: A description of the event that occurred. type: string example: Halt and catch fire runID: readOnly: true description: The ID of the task run that generated the event. type: string MemberExpression: description: Represents accessing a property of an object type: object properties: type: $ref: '#/components/schemas/NodeType' object: $ref: '#/components/schemas/Expression' property: $ref: '#/components/schemas/PropertyKey' MemberAssignment: description: Object property assignment type: object properties: type: $ref: '#/components/schemas/NodeType' member: $ref: '#/components/schemas/MemberExpression' init: $ref: '#/components/schemas/Expression' LineProtocolError: properties: code: description: Code is the machine-readable error code. readOnly: true type: string enum: - internal error - not found - conflict - invalid - empty value - unavailable message: readOnly: true description: Human-readable message. type: string op: readOnly: true description: Describes the logical code operation when the error occurred. Useful for debugging. type: string err: readOnly: true description: Stack of errors that occurred during processing of the request. Useful for debugging. type: string line: readOnly: true description: First line in the request body that contains malformed data. type: integer format: int32 required: - code WritePrecision: type: string enum: - ms - s - us - ns TestStatement: description: Declares a Flux test case type: object properties: type: $ref: '#/components/schemas/NodeType' assignment: $ref: '#/components/schemas/VariableAssignment' DictItem: description: A key-value pair in a dictionary. type: object properties: type: $ref: '#/components/schemas/NodeType' key: $ref: '#/components/schemas/Expression' val: $ref: '#/components/schemas/Expression' Link: type: string format: uri readOnly: true description: URI of resource. NodeType: description: Type of AST node type: string Error: properties: code: description: code is the machine-readable error code. readOnly: true type: string enum: - 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 message: readOnly: true description: Human-readable message. type: string op: readOnly: true description: Describes the logical code operation when the error occurred. Useful for debugging. type: string err: readOnly: true description: Stack of errors that occurred during processing of the request. Useful for debugging. type: string required: - code BinaryExpression: description: uses binary operators to act on two operands in an expression type: object properties: type: $ref: '#/components/schemas/NodeType' operator: type: string left: $ref: '#/components/schemas/Expression' right: $ref: '#/components/schemas/Expression' PipeLiteral: description: Represents a specialized literal value, indicating the left hand value of a pipe expression type: object properties: type: $ref: '#/components/schemas/NodeType' Links: type: object description: 'URI pointers for additional paged results. ' properties: next: $ref: '#/components/schemas/Link' self: $ref: '#/components/schemas/Link' prev: $ref: '#/components/schemas/Link' required: - self ObjectExpression: description: Allows the declaration of an anonymous object within a declaration type: object properties: type: $ref: '#/components/schemas/NodeType' properties: description: Object properties type: array items: $ref: '#/components/schemas/Property' Expression: oneOf: - $ref: '#/components/schemas/ArrayExpression' - $ref: '#/components/schemas/DictExpression' - $ref: '#/components/schemas/FunctionExpression' - $ref: '#/components/schemas/BinaryExpression' - $ref: '#/components/schemas/CallExpression' - $ref: '#/components/schemas/ConditionalExpression' - $ref: '#/components/schemas/LogicalExpression' - $ref: '#/components/schemas/MemberExpression' - $ref: '#/components/schemas/IndexExpression' - $ref: '#/components/schemas/ObjectExpression' - $ref: '#/components/schemas/ParenExpression' - $ref: '#/components/schemas/PipeExpression' - $ref: '#/components/schemas/UnaryExpression' - $ref: '#/components/schemas/BooleanLiteral' - $ref: '#/components/schemas/DateTimeLiteral' - $ref: '#/components/schemas/DurationLiteral' - $ref: '#/components/schemas/FloatLiteral' - $ref: '#/components/schemas/IntegerLiteral' - $ref: '#/components/schemas/PipeLiteral' - $ref: '#/components/schemas/RegexpLiteral' - $ref: '#/components/schemas/StringLiteral' - $ref: '#/components/schemas/UnsignedIntegerLiteral' - $ref: '#/components/schemas/Identifier' Block: description: A set of statements type: object properties: type: $ref: '#/components/schemas/NodeType' body: description: Block body type: array items: $ref: '#/components/schemas/Statement' ConditionalExpression: description: Selects one of two expressions, `Alternate` or `Consequent`, depending on a third boolean expression, `Test` type: object properties: type: $ref: '#/components/schemas/NodeType' test: $ref: '#/components/schemas/Expression' alternate: $ref: '#/components/schemas/Expression' consequent: $ref: '#/components/schemas/Expression' VariableAssignment: description: Represents the declaration of a variable type: object properties: type: $ref: '#/components/schemas/NodeType' id: $ref: '#/components/schemas/Identifier' init: $ref: '#/components/schemas/Expression' TaskCreateRequest: type: object properties: orgID: description: The ID of the organization that owns the task. type: string org: description: The name of the organization that owns the task. type: string status: $ref: '#/components/schemas/TaskStatusType' flux: description: 'The Flux script that the task runs. #### Limitations - If you use the `flux` property, you can''t use the `scriptID` and `scriptParameters` properties. ' type: string description: description: The description of the task. type: string scriptID: description: 'The ID of the script that the task runs. #### Limitations - If you use the `scriptID` property, you can''t use the `flux` property. ' type: string scriptParameters: description: '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. ' type: object name: description: The name of the task type: string every: description: 'The interval ([duration literal](https://docs.influxdata.com/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. ' type: string cron: description: 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. type: string offset: description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. type: string format: duration TaskStatusType: type: string enum: - active - inactive description: '`inactive` cancels scheduled runs and prevents manual runs of the task. ' ImportDeclaration: description: Declares a package import type: object properties: type: $ref: '#/components/schemas/NodeType' as: $ref: '#/components/schemas/Identifier' path: $ref: '#/components/schemas/StringLiteral' ReturnStatement: description: Defines an expression to return type: object properties: type: $ref: '#/components/schemas/NodeType' argument: $ref: '#/components/schemas/Expression' DeletePredicateRequest: description: The delete predicate request. type: object required: - start - stop properties: start: description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). The earliest time to delete from. ' type: string format: date-time stop: description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). The latest time to delete from. ' type: string format: date-time predicate: description: 'An expression in [delete predicate syntax](https://docs.influxdata.com/influxdb/cloud/reference/syntax/delete-predicate/). ' example: tag1="value1" and (tag2="value2" and tag3!="value3") type: string UnaryExpression: description: Uses operators to act on a single operand in an expression type: object properties: type: $ref: '#/components/schemas/NodeType' operator: type: string argument: $ref: '#/components/schemas/Expression' Tasks: type: object properties: links: readOnly: true $ref: '#/components/schemas/Links' tasks: type: array items: $ref: '#/components/schemas/Task' Statement: oneOf: - $ref: '#/components/schemas/BadStatement' - $ref: '#/components/schemas/VariableAssignment' - $ref: '#/components/schemas/MemberAssignment' - $ref: '#/components/schemas/ExpressionStatement' - $ref: '#/components/schemas/ReturnStatement' - $ref: '#/components/schemas/OptionStatement' - $ref: '#/components/schemas/BuiltinStatement' - $ref: '#/components/schemas/TestStatement' Property: description: The value associated with a key type: object properties: type: $ref: '#/components/schemas/NodeType' key: $ref: '#/components/schemas/PropertyKey' value: $ref: '#/components/schemas/Expression' CallExpression: description: Represents a function call type: object properties: type: $ref: '#/components/schemas/NodeType' callee: $ref: '#/components/schemas/Expression' arguments: description: Function arguments type: array items: $ref: '#/components/schemas/Expression' ExpressionStatement: description: May consist of an expression that doesn't return a value and is executed solely for its side-effects type: object properties: type: $ref: '#/components/schemas/NodeType' expression: $ref: '#/components/schemas/Expression' Node: oneOf: - $ref: '#/components/schemas/Expression' - $ref: '#/components/schemas/Block' BooleanLiteral: description: Represents boolean values type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: boolean DateTimeLiteral: description: Represents an instant in time with nanosecond precision in [RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339nano-timestamp). type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: string format: date-time Labels: type: array items: $ref: '#/components/schemas/Label' FloatLiteral: description: Represents floating point numbers according to the double representations defined by the IEEE-754-1985 type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: number UnsignedIntegerLiteral: description: Represents integer numbers type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: string Dialect: description: 'Options for tabular data output. Default output is [annotated CSV](https://docs.influxdata.com/influxdb/cloud/reference/syntax/annotated-csv/#csv-response-format) with headers. For more information about tabular data **dialect**, see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions). ' type: object properties: header: description: If true, the results contain a header row. type: boolean default: true delimiter: description: The separator used between cells. Default is a comma (`,`). type: string default: ',' maxLength: 1 minLength: 1 annotations: description: 'Annotation rows to include in the results. An _annotation_ is metadata associated with an object (column) in the data model. #### Related guides - See [Annotated CSV annotations](https://docs.influxdata.com/influxdb/cloud/reference/syntax/annotated-csv/#annotations) for examples and more information. For more information about **annotations** in tabular data, see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns). ' type: array uniqueItems: true items: type: string enum: - group - datatype - default commentPrefix: description: The character prefixed to comment strings. Default is a number sign (`#`). type: string default: '#' maxLength: 1 minLength: 0 dateTimeFormat: description: 'The format for timestamps in results. Default is [`RFC3339` date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp). To include nanoseconds in timestamps, use `RFC3339Nano`. #### Example formatted date/time values | Format | Value | |:------------|:----------------------------| | `RFC3339` | `"2006-01-02T15:04:05Z07:00"` | | `RFC3339Nano` | `"2006-01-02T15:04:05.999999999Z07:00"` | ' type: string default: RFC3339 enum: - RFC3339 - RFC3339Nano BuiltinStatement: description: Declares a builtin identifier and its type type: object properties: type: $ref: '#/components/schemas/NodeType' id: $ref: '#/components/schemas/Identifier' Query: description: Query InfluxDB with the Flux language type: object required: - query properties: extern: $ref: '#/components/schemas/File' query: description: The query script to execute. type: string type: description: The type of query. Must be "flux". type: string enum: - flux params: type: object additionalProperties: true description: "Key-value pairs passed as parameters during query execution.\n\nTo use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example:\n\n```json\n query: \"from(bucket: params.mybucket)\\\n |> range(start: params.rangeStart) |> limit(n:1)\"\n```\n\nand pass _`params`_ with the key-value pairs--for example:\n\n```json\n params: {\n \"mybucket\": \"environment\",\n \"rangeStart\": \"-30d\"\n }\n```\n\nDuring query execution, InfluxDB passes _`params`_ to your script and substitutes the values.\n\n#### Limitations\n\n- If you use _`params`_, you can't use _`extern`_.\n" dialect: $ref: '#/components/schemas/Dialect' now: description: 'Specifies the time that should be reported as `now` in the query. Default is the server `now` time. ' type: string format: date-time RunManually: properties: scheduledFor: nullable: true description: 'The time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp) used for the run''s `now` option. Default is the server _now_ time. ' type: string format: date-time Duration: description: A pair consisting of length of time and the unit of time measured. It is the atomic unit from which all duration literals are composed. type: object properties: type: $ref: '#/components/schemas/NodeType' magnitude: type: integer unit: type: string Task: type: object properties: id: readOnly: true type: string orgID: description: 'An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID. Specifies the organization that owns the task. ' type: string org: description: 'An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) name. Specifies the organization that owns the task. ' type: string name: description: The name of the task. type: string ownerID: description: 'A [user](https://docs.influxdata.com/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. ' type: string description: description: A description of the task. type: string status: $ref: '#/components/schemas/TaskStatusType' labels: $ref: '#/components/schemas/Labels' authorizationID: description: '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. ' type: string flux: description: "The Flux script that the task executes.\n\n#### Limitations\n - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties.\n" type: string format: flux every: description: The interval ([duration literal](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time. type: string format: duration cron: description: 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. type: string offset: description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. type: string format: duration latestCompleted: description: A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run. type: string format: date-time readOnly: true lastRunStatus: readOnly: true type: string enum: - failed - success - canceled lastRunError: readOnly: true type: string createdAt: type: string format: date-time readOnly: true updatedAt: type: string format: date-time readOnly: true links: type: object readOnly: true example: self: /api/v2/tasks/1 owners: /api/v2/tasks/1/owners members: /api/v2/tasks/1/members labels: /api/v2/tasks/1/labels runs: /api/v2/tasks/1/runs logs: /api/v2/tasks/1/logs properties: self: $ref: '#/components/schemas/Link' owners: $ref: '#/components/schemas/Link' members: $ref: '#/components/schemas/Link' runs: $ref: '#/components/schemas/Link' logs: $ref: '#/components/schemas/Link' labels: $ref: '#/components/schemas/Link' scriptID: description: '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](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) ' type: string scriptParameters: description: '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. ' type: object required: - id - name - orgID LineProtocolLengthError: properties: code: description: Code is the machine-readable error code. readOnly: true type: string enum: - invalid message: readOnly: true description: Human-readable message. type: string required: - code - message Run: properties: id: readOnly: true type: string taskID: readOnly: true type: string status: readOnly: true type: string enum: - scheduled - started - failed - success - canceled scheduledFor: description: The time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp) used for the run's `now` option. type: string format: date-time log: description: An array of logs associated with the run. type: array readOnly: true items: $ref: '#/components/schemas/LogEvent' flux: description: Flux used for the task type: string readOnly: true startedAt: readOnly: true description: The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run started executing. type: string format: date-time example: 2006-01-02T15:04:05.999999999Z07:00 finishedAt: readOnly: true description: The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run finished executing. type: string format: date-time example: 2006-01-02T15:04:05.999999999Z07:00 requestedAt: readOnly: true description: The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339nano-timestamp)) the run was manually requested. type: string format: date-time example: 2006-01-02T15:04:05.999999999Z07:00 links: type: object readOnly: true example: self: /api/v2/tasks/1/runs/1 task: /api/v2/tasks/1 retry: /api/v2/tasks/1/runs/1/retry properties: self: type: string format: uri task: type: string format: uri retry: type: string format: uri PropertyKey: oneOf: - $ref: '#/components/schemas/Identifier' - $ref: '#/components/schemas/StringLiteral' ArrayExpression: description: Used to create and directly specify the elements of an array object type: object properties: type: $ref: '#/components/schemas/NodeType' elements: description: Elements of the array type: array items: $ref: '#/components/schemas/Expression' PackageClause: description: Defines a package identifier type: object properties: type: $ref: '#/components/schemas/NodeType' name: $ref: '#/components/schemas/Identifier' ParenExpression: description: Represents an expression wrapped in parenthesis type: object properties: type: $ref: '#/components/schemas/NodeType' expression: $ref: '#/components/schemas/Expression' File: description: Represents a source from a single file type: object properties: type: $ref: '#/components/schemas/NodeType' name: description: The name of the file. type: string package: $ref: '#/components/schemas/PackageClause' imports: description: A list of package imports type: array items: $ref: '#/components/schemas/ImportDeclaration' body: description: List of Flux statements type: array items: $ref: '#/components/schemas/Statement' DurationLiteral: description: Represents the elapsed time between two instants as an int64 nanosecond count with syntax of golang's time.Duration type: object properties: type: $ref: '#/components/schemas/NodeType' values: description: Duration values type: array items: $ref: '#/components/schemas/Duration' FunctionExpression: description: Function expression type: object properties: type: $ref: '#/components/schemas/NodeType' params: description: Function parameters type: array items: $ref: '#/components/schemas/Property' body: $ref: '#/components/schemas/Node' OptionStatement: description: A single variable declaration type: object properties: type: $ref: '#/components/schemas/NodeType' assignment: oneOf: - $ref: '#/components/schemas/VariableAssignment' - $ref: '#/components/schemas/MemberAssignment' BadStatement: description: A placeholder for statements for which no correct statement nodes can be created type: object properties: type: $ref: '#/components/schemas/NodeType' text: description: Raw source text type: string IndexExpression: description: Represents indexing into an array type: object properties: type: $ref: '#/components/schemas/NodeType' array: $ref: '#/components/schemas/Expression' index: $ref: '#/components/schemas/Expression' Identifier: description: A valid Flux identifier type: object properties: type: $ref: '#/components/schemas/NodeType' name: type: string IntegerLiteral: description: Represents integer numbers type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: string DictExpression: description: Used to create and directly specify the elements of a dictionary type: object properties: type: $ref: '#/components/schemas/NodeType' elements: description: Elements of the dictionary type: array items: $ref: '#/components/schemas/DictItem' PipeExpression: description: Call expression with pipe argument type: object properties: type: $ref: '#/components/schemas/NodeType' argument: $ref: '#/components/schemas/Expression' call: $ref: '#/components/schemas/CallExpression' RegexpLiteral: description: Expressions begin and end with `/` and are regular expressions with syntax accepted by RE2 type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: string StringLiteral: description: Expressions begin and end with double quote marks type: object properties: type: $ref: '#/components/schemas/NodeType' value: type: string LogicalExpression: description: Represents the rule conditions that collectively evaluate to either true or false type: object properties: type: $ref: '#/components/schemas/NodeType' operator: type: string left: $ref: '#/components/schemas/Expression' right: $ref: '#/components/schemas/Expression' Label: type: object properties: id: readOnly: true type: string orgID: readOnly: true type: string name: type: string properties: type: object additionalProperties: type: string description: 'Key-value pairs associated with this label. To remove a property, send an update with an empty value (`""`) for the key. ' example: color: ffb3b3 description: this is a description parameters: TraceSpan: in: header name: Zap-Trace-Span description: OpenTracing span context example: trace_id: '1' span_id: '1' baggage: key: value required: false schema: type: string securitySchemes: TokenAuthentication: type: apiKey name: Authorization in: header description: "Use the [Token authentication](#section/Authentication/TokenAuthentication)\nscheme to authenticate to the InfluxDB API.\n\nIn your API requests, send an `Authorization` header.\nFor the header value, provide the word `Token` followed by a space and an InfluxDB API token.\nThe word `Token` is case-sensitive.\n\n### Syntax\n\n`Authorization: Token INFLUX_API_TOKEN`\n\n### Example\n\n#### Use Token authentication with cURL\n\nThe following example shows how to use cURL to send an API request that uses Token authentication:\n\n```sh\ncurl --request GET \"INFLUX_URL/api/v2/buckets\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n```\n\nReplace the following:\n\n - *`INFLUX_URL`*: your InfluxDB Cloud URL\n - *`INFLUX_API_TOKEN`*: your [InfluxDB API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token)\n\n### Related endpoints\n\n- [`/authorizations` endpoints](#tag/Authorizations-(API-tokens))\n\n### Related guides\n\n- [Authorize API requests](https://docs.influxdata.com/influxdb/cloud/api-guide/api_intro/#authentication)\n- [Manage API tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/)\n" BasicAuthentication: type: http scheme: basic description: "### Basic authentication scheme\n\nUse the HTTP Basic authentication scheme for InfluxDB `/api/v2` API operations that support it:\n\n### Syntax\n\n`Authorization: Basic BASE64_ENCODED_CREDENTIALS`\n\nTo construct the `BASE64_ENCODED_CREDENTIALS`, combine the username and\nthe password with a colon (`USERNAME:PASSWORD`), and then encode the\nresulting string in [base64](https://developer.mozilla.org/en-US/docs/Glossary/Base64).\nMany HTTP clients encode the credentials for you before sending the\nrequest.\n\n_**Warning**: Base64-encoding can easily be reversed to obtain the original\nusername and password. It is used to keep the data intact and does not provide\nsecurity. You should always use HTTPS when authenticating or sending a request with\nsensitive information._\n\n### Examples\n\nIn the examples, replace the following:\n\n- **`EMAIL_ADDRESS`**: InfluxDB Cloud username (the email address the user signed up with)\n- **`PASSWORD`**: InfluxDB Cloud [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token)\n- **`INFLUX_URL`**: your InfluxDB Cloud URL\n\n#### Encode credentials with cURL\n\nThe following example shows how to use cURL to send an API request that uses Basic authentication.\nWith the `--user` option, cURL encodes the credentials and passes them\nin the `Authorization: Basic` header.\n\n```sh\ncurl --get \"INFLUX_URL/api/v2/signin\"\n --user \"EMAIL_ADDRESS\":\"PASSWORD\"\n```\n\n#### Encode credentials with Flux\n\nThe Flux [`http.basicAuth()` function](https://docs.influxdata.com/flux/v0.x/stdlib/http/basicauth/) returns a Base64-encoded\nbasic authentication header using a specified username and password combination.\n\n#### Encode credentials with JavaScript\n\nThe following example shows how to use the JavaScript `btoa()` function\nto create a Base64-encoded string:\n\n```js\nbtoa('EMAIL_ADDRESS:PASSWORD')\n```\n\nThe output is the following:\n\n```js\n'VVNFUk5BTUU6UEFTU1dPUkQ='\n```\n\nOnce you have the Base64-encoded credentials, you can pass them in the\n`Authorization` header--for example:\n\n```sh\ncurl --get \"INFLUX_URL/api/v2/signin\"\n --header \"Authorization: Basic VVNFUk5BTUU6UEFTU1dPUkQ=\"\n```\n\nTo learn more about HTTP authentication, see\n[Mozilla Developer Network (MDN) Web Docs, HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication)._\n" x-tagGroups: - name: Overview tags: - Quick start - Authentication - Supported operations - Headers - Pagination - Response codes - name: Popular endpoints tags: - Data I/O endpoints - Security and access endpoints - System information endpoints - name: All endpoints tags: []