openapi: 3.0.0 info: title: InfluxDB Cloud API Service Authorizations (API tokens) Authorizations (API tokens) Tasks 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: Tasks description: 'Process and analyze your data with [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) in the InfluxDB task engine. Use the `/api/v2/tasks` endpoints to schedule and manage tasks, retry task runs, and retrieve run logs. To configure a task, provide the script and the schedule to run the task. For examples, see how to create a task with the [`POST /api/v2/tasks` endpoint](#operation/PostTasks). ### Properties A `task` object contains information about an InfluxDB task resource. The following table defines the properties that appear in this object: ### Related guides - [Get started with tasks](https://docs.influxdata.com/influxdb/cloud/process-data/get-started/) - [Common data processing tasks](https://docs.influxdata.com/influxdb/cloud/process-data/common-tasks/) - [Create a script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/#create-an-invokable-script) ' paths: /tasks/{taskID}/runs: get: operationId: GetTasksIDRuns tags: - Tasks summary: List runs for a task description: 'Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/cloud/process-data/). To limit which task runs are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: 'The ID of the task to get runs for. Only returns runs for this task. ' - in: query name: after schema: type: string description: A task run ID. Only returns runs created after this run. - in: query name: limit schema: type: integer minimum: 1 maximum: 500 default: 100 description: 'Limits the number of task runs returned. Default is `100`. ' - in: query name: afterTime schema: type: string format: date-time description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). Only returns runs scheduled after this time. ' - in: query name: beforeTime schema: type: string format: date-time description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). Only returns runs scheduled before this time. ' responses: '200': description: Success. The response body contains the list of task runs. content: application/json: schema: $ref: '#/components/schemas/Runs' '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' post: operationId: PostTasksIDRuns tags: - Tasks 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/{taskID}/runs/{runID}: get: operationId: GetTasksIDRunsID tags: - Tasks summary: Retrieve a run for a task. description: 'Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to retrieve runs for. - in: path name: runID schema: type: string required: true description: The ID of the run to retrieve. responses: '200': description: Success. The response body contains the task run. content: application/json: schema: $ref: '#/components/schemas/Run' examples: runSuccess: summary: A successful task run. value: links: logs: /api/v2/tasks/0996e56b2f378000/runs/09b070dadaa7d000/logs retry: /api/v2/tasks/0996e56b2f378000/runs/09b070dadaa7d000/retry self: /api/v2/tasks/0996e56b2f378000/runs/09b070dadaa7d000 task: /api/v2/tasks/0996e56b2f378000 id: 09b070dadaa7d000 taskID: 0996e56b2f378000 status: success scheduledFor: '2022-07-18T14:46:06Z' startedAt: '2022-07-18T14:46:07.16222Z' finishedAt: '2022-07-18T14:46:07.308254Z' requestedAt: '2022-07-18T14:46:06Z' log: - runID: 09b070dadaa7d000 time: '2022-07-18T14:46:07.101231Z' message: 'Started task from script: "option task = {name: \"task1\", every: 30m} from(bucket: \"iot_center\") |> range(start: -90d) |> filter(fn: (r) => r._measurement == \"environment\") |> aggregateWindow(every: 1h, fn: mean)"' - runID: 09b070dadaa7d000 time: '2022-07-18T14:46:07.242859Z' message: Completed(success) '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' delete: operationId: DeleteTasksIDRunsID tags: - Tasks summary: Cancel a running task description: 'Cancels a running [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud - Doesn''t support this operation. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to cancel. - in: path name: runID schema: type: string required: true description: The ID of the task run to cancel. responses: '204': description: 'Success. The `DELETE` is accepted and the run will be cancelled. #### InfluxDB Cloud - Doesn''t support this operation. - Doesn''t return this status. ' '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '405': description: "Method not allowed.\n\n#### InfluxDB Cloud\n\n - Always returns this error; doesn't support cancelling tasks.\n\n#### InfluxDB OSS\n\n - Doesn't return this error.\n" content: application/json: schema: $ref: '#/components/schemas/Error' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' /tasks/{taskID}/runs/{runID}/retry: post: operationId: PostTasksIDRunsIDRetry tags: - Tasks summary: Retry a task run description: 'Queues a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run to retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - The task must be _active_ (`status: "active"`). ' requestBody: content: application/json; charset=utf-8: schema: type: object 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 retry. ' - in: path name: runID schema: type: string required: true description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the [`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns) to list task runs. ' responses: '200': description: Success. The response body contains the queued run. content: application/json: schema: $ref: '#/components/schemas/Run' examples: retryTaskRun: summary: A task run scheduled to retry value: links: logs: /api/v2/tasks/09a776832f381000/runs/09d60ffe08738000/logs retry: /api/v2/tasks/09a776832f381000/runs/09d60ffe08738000/retry self: /api/v2/tasks/09a776832f381000/runs/09d60ffe08738000 task: /api/v2/tasks/09a776832f381000 id: 09d60ffe08738000 taskID: 09a776832f381000 status: scheduled scheduledFor: '2022-08-15T00:00:00Z' requestedAt: '2022-08-16T20:05:11.84145Z' '400': description: 'Bad request. The response body contains detail about the error. InfluxDB may return this error for the following reasons: - The task has `status: inactive`. ' content: application/json: schema: $ref: '#/components/schemas/Error' examples: inactiveTask: summary: Can't retry an inactive task value: code: invalid message: 'failed to retry run: inactive task' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' /tasks/{taskID}/logs: get: operationId: GetTasksIDLogs tags: - Tasks summary: Retrieve all logs for a task description: 'Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). When an InfluxDB task runs, a “run” record is created in the task’s history. Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The task ID. responses: '200': description: 'Success. The response body contains an `events` list with logs for the task. Each log event `message` contains detail about the event. If a task run fails, InfluxDB logs an event with the reason for the failure. ' content: application/json: schema: $ref: '#/components/schemas/Logs' examples: taskSuccess: summary: Events for a successful task run. value: events: - runID: 09b070dadaa7d000 time: '2022-07-18T14:46:07.101231Z' message: 'Started task from script: "option task = {name: \"task1\", every: 30m} from(bucket: \"iot_center\") |> range(start: -90d) |> filter(fn: (r) => r._measurement == \"environment\") |> aggregateWindow(every: 1h, fn: mean)"' - runID: 09b070dadaa7d000 time: '2022-07-18T14:46:07.242859Z' message: Completed(success) taskFailure: summary: Events for a failed task run. value: events: - runID: 09a946fc3167d000 time: '2022-07-13T07:06:54.198167Z' message: 'Started task from script: "option task = {name: \"test task\", every: 3d, offset: 0s}"' - runID: 09a946fc3167d000 time: '2022-07-13T07:07:13.104037Z' message: Completed(failed) - runID: 09a946fc3167d000 time: '2022-07-13T08:24:37.115323Z' message: 'error exhausting result iterator: error in query specification while starting program: this Flux script returns no streaming data. Consider adding a "yield" or invoking streaming functions directly, without performing an assignment' '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' /tasks/{taskID}/runs/{runID}/logs: get: operationId: GetTasksIDRunsIDLogs tags: - Tasks summary: Retrieve all logs for a run description: 'Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. Use this endpoint to help analyze task performance and troubleshoot failed task runs. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to get logs for. - in: path name: runID schema: type: string required: true description: The ID of the run to get logs for. responses: '200': description: 'Success. The response body contains an `events` list with logs for the task run. Each log event `message` contains detail about the event. If a run fails, InfluxDB logs an event with the reason for the failure. ' content: application/json: schema: $ref: '#/components/schemas/Logs' examples: taskSuccess: summary: Events for a successful task run. value: events: - runID: 09b070dadaa7d000 time: '2022-07-18T14:46:07.101231Z' message: 'Started task from script: "option task = {name: \"task1\", every: 30m} from(bucket: \"iot_center\") |> range(start: -90d) |> filter(fn: (r) => r._measurement == \"environment\") |> aggregateWindow(every: 1h, fn: mean)"' - runID: 09b070dadaa7d000 time: '2022-07-18T14:46:07.242859Z' message: Completed(success) taskFailure: summary: Events for a failed task. value: events: - runID: 09a946fc3167d000 time: '2022-07-13T07:06:54.198167Z' message: 'Started task from script: "option task = {name: \"test task\", every: 3d, offset: 0s}"' - runID: 09a946fc3167d000 time: '2022-07-13T07:07:13.104037Z' message: Completed(failed) - runID: 09a946fc3167d000 time: '2022-07-13T08:24:37.115323Z' message: 'error exhausting result iterator: error in query specification while starting program: this Flux script returns no streaming data. Consider adding a "yield" or invoking streaming functions directly, without performing an assignment' '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' /tasks/{taskID}/labels: get: operationId: GetTasksIDLabels tags: - Tasks summary: List labels for a task description: 'Retrieves a list of all labels for a task. Labels may be used for grouping and filtering tasks. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to retrieve labels for. responses: '200': description: Success. The response body contains a list of all labels for the task. content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' '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' post: operationId: PostTasksIDLabels tags: - Tasks summary: Add a label to a task description: 'Adds a label to a task. Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to label. requestBody: description: An object that contains a _`labelID`_ to add to the task. required: true content: application/json: schema: $ref: '#/components/schemas/LabelMapping' responses: '201': description: Success. The response body contains a list of all labels for the task. content: application/json: schema: $ref: '#/components/schemas/LabelResponse' '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' /tasks/{taskID}/labels/{labelID}: delete: operationId: DeleteTasksIDLabelsID tags: - Tasks summary: Delete a label from a task description: 'Deletes a label from a task. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to delete the label from. - in: path name: labelID schema: type: string required: true description: The ID of the label to delete. responses: '204': description: Success. The label is deleted. '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' /tasks/{taskID}/members: get: operationId: GetTasksIDMembers deprecated: true tags: - Tasks summary: List all task members description: '**Deprecated**: Tasks don''t use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Lists all users that have the `member` role for the specified [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: The task ID. responses: '200': description: 'Success. The response body contains a list of `users` that have the `member` role for a task. ' content: application/json: schema: $ref: '#/components/schemas/ResourceMembers' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' post: operationId: PostTasksIDMembers deprecated: true tags: - Tasks summary: Add a member to a task description: '**Deprecated**: Tasks don''t use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Adds a user to members of a task and returns the member. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The task ID. requestBody: description: A user to add as a member of the task. required: true content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': description: Created. The user is added to task members. content: application/json: schema: $ref: '#/components/schemas/ResourceMember' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' /tasks/{taskID}/members/{userID}: delete: operationId: DeleteTasksIDMembersID deprecated: true tags: - Tasks summary: Remove a member from a task description: '**Deprecated**: Tasks don''t use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Removes a member from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: userID schema: type: string required: true description: The ID of the member to remove. - in: path name: taskID schema: type: string required: true description: The task ID. responses: '204': description: Member removed default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' /tasks/{taskID}/owners: get: operationId: GetTasksIDOwners deprecated: true tags: - Tasks summary: List all owners of a task description: '**Deprecated**: Tasks don''t use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Retrieves all users that have owner permission for a task. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The ID of the task to retrieve owners for. responses: '200': description: 'Success. The response contains a list of `users` that have the `owner` role for the task. If the task has no owners, the response contains an empty `users` array. ' content: application/json: schema: $ref: '#/components/schemas/ResourceOwners' '401': $ref: '#/components/responses/AuthorizationError' '422': description: 'Unprocessable entity. The error may indicate one of the following problems: - The request body isn''t valid--the request is well-formed, but InfluxDB can''t process it due to semantic errors. - You passed a parameter combination that InfluxDB doesn''t support. ' content: application/json: schema: $ref: '#/components/schemas/Error' '500': $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' post: operationId: PostTasksIDOwners deprecated: true tags: - Tasks summary: Add an owner for a task description: '**Deprecated**: Tasks don''t use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: taskID schema: type: string required: true description: The task ID. requestBody: description: A user to add as an owner of the task. required: true content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': description: 'Created. The task `owner` role is assigned to the user. The response body contains the resource owner with role and user detail. ' content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' examples: createdOwner: summary: User has the owner role for the resource value: role: owner links: logs: /api/v2/users/0772396d1f411000/logs self: /api/v2/users/0772396d1f411000 id: 0772396d1f411000 name: USER_NAME status: active '401': $ref: '#/components/responses/AuthorizationError' '422': description: 'Unprocessable entity. The error may indicate one of the following problems: - The request body isn''t valid--the request is well-formed, but InfluxDB can''t process it due to semantic errors. - You passed a parameter combination that InfluxDB doesn''t support. ' content: application/json: schema: $ref: '#/components/schemas/Error' '500': $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' /tasks/{taskID}/owners/{userID}: delete: operationId: DeleteTasksIDOwnersID deprecated: true tags: - Tasks summary: Remove an owner from a task description: '**Deprecated**: Tasks don''t use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. ' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: userID schema: type: string required: true description: The ID of the owner to remove. - in: path name: taskID schema: type: string required: true description: The task ID. responses: '204': description: Owner removed default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' /tasks: get: operationId: GetTasks tags: - Tasks 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: - Tasks 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: - Tasks 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' patch: operationId: PatchTasksID tags: - Tasks summary: Update a task description: "Updates a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task),\nand then cancels all scheduled runs of the task.\n\nUse this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`.\nOnce InfluxDB applies the update, it cancels all previously scheduled runs of the task.\n\nTo update a task, pass an object that contains the updated key-value pairs.\nTo activate or inactivate a task, set the `status` property.\n_`\"status\": \"inactive\"`_ cancels scheduled runs and prevents manual runs of the task.\n\n#### InfluxDB Cloud\n\n- 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" requestBody: description: An task update to apply. required: true content: application/json: schema: $ref: '#/components/schemas/TaskUpdateRequest' 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 update. ' responses: '200': description: Success. The response body contains the updated 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' delete: operationId: DeleteTasksID tags: - Tasks summary: Delete a task description: 'Deletes a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and associated records. Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). ' 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 delete. responses: '204': description: Success. The task and task runs are deleted. Scheduled runs are canceled. '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 AddResourceMemberRequestBody: type: object properties: id: type: string description: 'The ID of the user to add to the resource. ' name: type: string description: 'The name of the user to add to the resource. ' required: - id Runs: type: object properties: links: $ref: '#/components/schemas/Links' runs: type: array items: $ref: '#/components/schemas/Run' Link: type: string format: uri readOnly: true description: URI of resource. 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 ResourceMember: allOf: - $ref: '#/components/schemas/UserResponse' - type: object properties: role: type: string default: member enum: - member 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 Logs: type: object properties: events: readOnly: true type: array items: $ref: '#/components/schemas/LogEvent' TaskStatusType: type: string enum: - active - inactive description: '`inactive` cancels scheduled runs and prevents manual runs of the task. ' 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 Tasks: type: object properties: links: readOnly: true $ref: '#/components/schemas/Links' tasks: type: array items: $ref: '#/components/schemas/Task' ResourceOwners: type: object properties: links: type: object properties: self: type: string format: uri users: type: array items: $ref: '#/components/schemas/ResourceOwner' LabelMapping: type: object description: A _label mapping_ contains a `label` ID to attach to a resource. properties: labelID: description: 'A label ID. Specifies the label to attach. ' type: string required: - labelID Labels: type: array items: $ref: '#/components/schemas/Label' UserResponse: properties: id: readOnly: true type: string description: 'The user ID. ' name: type: string description: 'The user name. ' status: description: 'The status of a user. An inactive user can''t read or write resources. ' default: active type: string enum: - active - inactive links: type: object readOnly: true example: self: /api/v2/users/1 properties: self: type: string format: uri required: - name 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 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 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 TaskUpdateRequest: type: object properties: status: $ref: '#/components/schemas/TaskStatusType' flux: description: Update the Flux script that the task runs. type: string name: description: Update the 'name' option in the flux script. type: string every: description: Update the 'every' option in the flux script. type: string cron: description: Update the 'cron' option in the flux script. type: string offset: description: Update the 'offset' option in the flux script. type: string description: description: Update the description of the task. type: string scriptID: description: Update the 'scriptID' of the task. type: string scriptParameters: description: Update the 'scriptParameters' of the task. type: object ResourceOwner: allOf: - $ref: '#/components/schemas/UserResponse' - type: object properties: role: type: string default: owner enum: - owner LabelsResponse: type: object properties: labels: $ref: '#/components/schemas/Labels' links: $ref: '#/components/schemas/Links' ResourceMembers: type: object properties: links: type: object properties: self: type: string format: uri users: type: array items: $ref: '#/components/schemas/ResourceMember' LabelResponse: type: object properties: label: $ref: '#/components/schemas/Label' links: $ref: '#/components/schemas/Links' 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 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: []