openapi: 3.0.0
info:
title: Complete InfluxDB Cloud Authorizations (API tokens) Authorizations (API tokens) Tasks API
description: 'Create and manage authorizations (API tokens).
An _authorization_ contains a list of `read` and `write`
permissions for organization resources and provides an API token for authentication.
An authorization belongs to an organization and only contains permissions for that organization.
We recommend the following for managing your tokens:
- Create a generic user to create and manage tokens for writing data.
- Store your tokens in a secure password vault for future access.
### User sessions with authorizations
Optionally, when creating an authorization, you can scope it to a specific user.
If the user signs in with username and password, creating a _user session_,
the session carries the permissions granted by all the user''s authorizations.
For more information, see [how to assign a token to a specific user](https://docs.influxdata.com/influxdb/cloud/security/tokens/create-token/).
To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).
### Related endpoints
- [Signin](#tag/Signin)
- [Signout](#tag/Signout)
### Related guides
- [Authorize API requests](https://docs.influxdata.com/influxdb/cloud/api-guide/api_intro/#authentication)
- [Manage API tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/)
- [Assign a token to a specific user](https://docs.influxdata.com/influxdb/cloud/security/tokens/create-token/)
'
servers:
- url: ''
security:
- TokenAuthentication: []
tags:
- 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)
'
name: Tasks
paths:
/api/v2/tasks:
get:
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`.
'
operationId: GetTasks
parameters:
- $ref: '#/components/parameters/TraceSpan'
- 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.
'
in: query
name: name
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: after
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: user
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: org
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: orgID
schema:
type: string
- 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: status
schema:
enum:
- active
- inactive
type: string
- 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:
all:
summary: Return all tasks, without pagination.
value: '-1'
minPaginated:
summary: Return a maximum of 50 tasks.
value: '50'
in: query
name: limit
schema:
default: 100
maximum: 500
minimum: -1
type: integer
- description: The number of records to skip.
in: query
name: offset
required: false
schema:
default: 0
minimum: 0
type: integer
- description: 'The sort field. Only `name` is supported.
Specifies the field used to sort records in the list.
'
in: query
name: sortBy
required: false
schema:
enum:
- name
type: string
- 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`).
'
in: query
name: type
required: false
schema:
default: ''
enum:
- basic
- system
type: string
- description: 'A [script](#tag/Invokable-Scripts) ID.
Only returns tasks that use the specified invokable script.
'
in: query
name: scriptID
schema:
type: string
responses:
'200':
content:
application/json:
examples:
basicTypeTaskOutput:
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.
'
summary: Basic output
value:
links:
self: /api/v2/tasks?limit=100
tasks:
- every: 30m
flux: ''
id: 09956cbb6d378000
labels: []
lastRunStatus: success
latestCompleted: '2022-06-30T15:00:00Z'
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
name: task1
org: ''
orgID: 48c88459ee424a04
ownerID: 0772396d1f411000
status: active
systemTypeTaskOutput:
description: 'A sample response body for the `?type=system` parameter.
`type=system` returns all task fields.
'
summary: System output
value:
links:
self: /api/v2/tasks?limit=100
tasks:
- createdAt: '2022-06-27T15:09:06Z'
description: IoT Center 90-day environment average.
every: 30m
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)"
id: 09956cbb6d378000
labels: []
lastRunStatus: success
latestCompleted: '2022-06-30T15:00:00Z'
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
name: task1
org: my-iot-center
orgID: 48c88459ee424a04
ownerID: 0772396d1f411000
status: active
updatedAt: '2022-06-28T18:10:15Z'
schema:
$ref: '#/components/schemas/Tasks'
description: 'Success.
The response body contains the list of tasks.
'
'401':
$ref: '#/components/responses/AuthorizationError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
$ref: '#/components/responses/GeneralServerError'
summary: List all tasks
tags:
- Tasks
x-codeSamples:
- label: 'cURL: all tasks, basic output'
lang: Shell
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:
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"
operationId: PostTasks
parameters:
- $ref: '#/components/parameters/TraceSpan'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreateRequest'
description: The task to create
required: true
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Task'
description: Success. The response body contains a `tasks` list with the new task.
'400':
content:
application/json:
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'
schema:
$ref: '#/components/schemas/Error'
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`_.
'
'401':
$ref: '#/components/responses/AuthorizationError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: Create a task
tags:
- Tasks
x-codeSamples:
- label: 'cURL: create a Flux script task'
lang: Shell
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"
- label: 'cURL: create a Flux script reference task'
lang: Shell
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"
/api/v2/tasks/{taskID}:
delete:
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).
'
operationId: DeleteTasksID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. Specifies the task to delete.
in: path
name: taskID
required: true
schema:
type: string
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'
summary: Delete a task
tags:
- Tasks
get:
description: 'Retrieves a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task).
'
operationId: GetTasksID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID.
Specifies the task to retrieve.
'
in: path
name: taskID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Task'
description: Success. The response body contains the 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'
summary: Retrieve a task
tags:
- Tasks
patch:
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"
operationId: PatchTasksID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID.
Specifies the task to update.
'
in: path
name: taskID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TaskUpdateRequest'
description: An task update to apply.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Task'
description: Success. The response body contains the updated 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'
summary: Update a task
tags:
- Tasks
/api/v2/tasks/{taskID}/labels:
get:
description: 'Retrieves a list of all labels for a task.
Labels may be used for grouping and filtering tasks.
'
operationId: GetTasksIDLabels
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to retrieve labels for.
in: path
name: taskID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/LabelsResponse'
description: Success. The response body contains a list of all labels for the 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'
summary: List labels for a task
tags:
- Tasks
post:
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.
'
operationId: PostTasksIDLabels
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to label.
in: path
name: taskID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LabelMapping'
description: An object that contains a _`labelID`_ to add to the task.
required: true
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/LabelResponse'
description: Success. The response body contains a list of all labels for the 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'
summary: Add a label to a task
tags:
- Tasks
/api/v2/tasks/{taskID}/labels/{labelID}:
delete:
description: 'Deletes a label from a task.
'
operationId: DeleteTasksIDLabelsID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to delete the label from.
in: path
name: taskID
required: true
schema:
type: string
- description: The ID of the label to delete.
in: path
name: labelID
required: true
schema:
type: string
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'
summary: Delete a label from a task
tags:
- Tasks
/api/v2/tasks/{taskID}/logs:
get:
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.
'
operationId: GetTasksIDLogs
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The task ID.
in: path
name: taskID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
examples:
taskFailure:
summary: Events for a failed task run.
value:
events:
- message: 'Started task from script: "option task = {name: \"test task\", every: 3d, offset: 0s}"'
runID: 09a946fc3167d000
time: '2022-07-13T07:06:54.198167Z'
- message: Completed(failed)
runID: 09a946fc3167d000
time: '2022-07-13T07:07:13.104037Z'
- 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'
runID: 09a946fc3167d000
time: '2022-07-13T08:24:37.115323Z'
taskSuccess:
summary: Events for a successful task run.
value:
events:
- 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.101231Z'
- message: Completed(success)
runID: 09b070dadaa7d000
time: '2022-07-18T14:46:07.242859Z'
schema:
$ref: '#/components/schemas/Logs'
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.
'
'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'
summary: Retrieve all logs for a task
tags:
- Tasks
/api/v2/tasks/{taskID}/members:
get:
deprecated: true
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).
'
operationId: GetTasksIDMembers
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The task ID.
in: path
name: taskID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceMembers'
description: 'Success. The response body contains a list of `users` that have
the `member` role for a task.
'
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: List all task members
tags:
- Tasks
post:
deprecated: true
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.
'
operationId: PostTasksIDMembers
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The task ID.
in: path
name: taskID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddResourceMemberRequestBody'
description: A user to add as a member of the task.
required: true
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceMember'
description: Created. The user is added to task members.
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: Add a member to a task
tags:
- Tasks
/api/v2/tasks/{taskID}/members/{userID}:
delete:
deprecated: true
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).
'
operationId: DeleteTasksIDMembersID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the member to remove.
in: path
name: userID
required: true
schema:
type: string
- description: The task ID.
in: path
name: taskID
required: true
schema:
type: string
responses:
'204':
description: Member removed
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: Remove a member from a task
tags:
- Tasks
/api/v2/tasks/{taskID}/owners:
get:
deprecated: true
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.
'
operationId: GetTasksIDOwners
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to retrieve owners for.
in: path
name: taskID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceOwners'
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.
'
'401':
$ref: '#/components/responses/AuthorizationError'
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
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.
'
'500':
$ref: '#/components/responses/InternalServerError'
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: List all owners of a task
tags:
- Tasks
post:
deprecated: true
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.
'
operationId: PostTasksIDOwners
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The task ID.
in: path
name: taskID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddResourceMemberRequestBody'
description: A user to add as an owner of the task.
required: true
responses:
'201':
content:
application/json:
examples:
createdOwner:
summary: User has the owner role for the resource
value:
id: 0772396d1f411000
links:
logs: /api/v2/users/0772396d1f411000/logs
self: /api/v2/users/0772396d1f411000
name: USER_NAME
role: owner
status: active
schema:
$ref: '#/components/schemas/ResourceOwner'
description: 'Created. The task `owner` role is assigned to the user.
The response body contains the resource owner with
role and user detail.
'
'401':
$ref: '#/components/responses/AuthorizationError'
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
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.
'
'500':
$ref: '#/components/responses/InternalServerError'
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: Add an owner for a task
tags:
- Tasks
/api/v2/tasks/{taskID}/owners/{userID}:
delete:
deprecated: true
description: '**Deprecated**: Tasks don''t use `owner` and `member` roles.
Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.
'
operationId: DeleteTasksIDOwnersID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the owner to remove.
in: path
name: userID
required: true
schema:
type: string
- description: The task ID.
in: path
name: taskID
required: true
schema:
type: string
responses:
'204':
description: Owner removed
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Unexpected error
summary: Remove an owner from a task
tags:
- Tasks
/api/v2/tasks/{taskID}/runs:
get:
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`.
'
operationId: GetTasksIDRuns
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: 'The ID of the task to get runs for.
Only returns runs for this task.
'
in: path
name: taskID
required: true
schema:
type: string
- description: A task run ID. Only returns runs created after this run.
in: query
name: after
schema:
type: string
- description: 'Limits the number of task runs returned. Default is `100`.
'
in: query
name: limit
schema:
default: 100
maximum: 500
minimum: 1
type: integer
- 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: afterTime
schema:
format: date-time
type: string
- description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)).
Only returns runs scheduled before this time.
'
in: query
name: beforeTime
schema:
format: date-time
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Runs'
description: Success. The response body contains the list of task runs.
'401':
$ref: '#/components/responses/AuthorizationError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
$ref: '#/components/responses/GeneralServerError'
summary: List runs for a task
tags:
- Tasks
post:
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).
'
operationId: PostTasksIDRuns
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: path
name: taskID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RunManually'
responses:
'201':
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
description: Success. The run is scheduled to start.
'401':
$ref: '#/components/responses/AuthorizationError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
$ref: '#/components/responses/GeneralServerError'
summary: Start a task run, overriding the schedule
tags:
- Tasks
/api/v2/tasks/{taskID}/runs/{runID}:
delete:
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.
'
operationId: DeleteTasksIDRunsID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to cancel.
in: path
name: taskID
required: true
schema:
type: string
- description: The ID of the task run to cancel.
in: path
name: runID
required: true
schema:
type: string
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':
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
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"
'500':
$ref: '#/components/responses/InternalServerError'
default:
$ref: '#/components/responses/GeneralServerError'
summary: Cancel a running task
tags:
- Tasks
get:
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.
'
operationId: GetTasksIDRunsID
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to retrieve runs for.
in: path
name: taskID
required: true
schema:
type: string
- description: The ID of the run to retrieve.
in: path
name: runID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
examples:
runSuccess:
summary: A successful task run.
value:
finishedAt: '2022-07-18T14:46:07.308254Z'
id: 09b070dadaa7d000
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
log:
- 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.101231Z'
- message: Completed(success)
runID: 09b070dadaa7d000
time: '2022-07-18T14:46:07.242859Z'
requestedAt: '2022-07-18T14:46:06Z'
scheduledFor: '2022-07-18T14:46:06Z'
startedAt: '2022-07-18T14:46:07.16222Z'
status: success
taskID: 0996e56b2f378000
schema:
$ref: '#/components/schemas/Run'
description: Success. The response body contains the task run.
'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'
summary: Retrieve a run for a task.
tags:
- Tasks
/api/v2/tasks/{taskID}/runs/{runID}/logs:
get:
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.
'
operationId: GetTasksIDRunsIDLogs
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: The ID of the task to get logs for.
in: path
name: taskID
required: true
schema:
type: string
- description: The ID of the run to get logs for.
in: path
name: runID
required: true
schema:
type: string
responses:
'200':
content:
application/json:
examples:
taskFailure:
summary: Events for a failed task.
value:
events:
- message: 'Started task from script: "option task = {name: \"test task\", every: 3d, offset: 0s}"'
runID: 09a946fc3167d000
time: '2022-07-13T07:06:54.198167Z'
- message: Completed(failed)
runID: 09a946fc3167d000
time: '2022-07-13T07:07:13.104037Z'
- 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'
runID: 09a946fc3167d000
time: '2022-07-13T08:24:37.115323Z'
taskSuccess:
summary: Events for a successful task run.
value:
events:
- 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.101231Z'
- message: Completed(success)
runID: 09b070dadaa7d000
time: '2022-07-18T14:46:07.242859Z'
schema:
$ref: '#/components/schemas/Logs'
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.
'
'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'
summary: Retrieve all logs for a run
tags:
- Tasks
/api/v2/tasks/{taskID}/runs/{runID}/retry:
post:
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"`).
'
operationId: PostTasksIDRunsIDRetry
parameters:
- $ref: '#/components/parameters/TraceSpan'
- description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID.
Specifies the task to retry.
'
in: path
name: taskID
required: true
schema:
type: string
- 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.
'
in: path
name: runID
required: true
schema:
type: string
requestBody:
content:
application/json; charset=utf-8:
schema:
type: object
responses:
'200':
content:
application/json:
examples:
retryTaskRun:
summary: A task run scheduled to retry
value:
id: 09d60ffe08738000
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
requestedAt: '2022-08-16T20:05:11.84145Z'
scheduledFor: '2022-08-15T00:00:00Z'
status: scheduled
taskID: 09a776832f381000
schema:
$ref: '#/components/schemas/Run'
description: Success. The response body contains the queued run.
'400':
content:
application/json:
examples:
inactiveTask:
summary: Can't retry an inactive task
value:
code: invalid
message: 'failed to retry run: inactive task'
schema:
$ref: '#/components/schemas/Error'
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`.
'
'401':
$ref: '#/components/responses/AuthorizationError'
'404':
$ref: '#/components/responses/ResourceNotFoundError'
'500':
$ref: '#/components/responses/InternalServerError'
default:
$ref: '#/components/responses/GeneralServerError'
summary: Retry a task run
tags:
- Tasks
components:
schemas:
Task:
properties:
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
createdAt:
format: date-time
readOnly: true
type: string
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
description:
description: A description of the task.
type: string
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.
format: duration
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"
format: flux
type: string
id:
readOnly: true
type: string
labels:
$ref: '#/components/schemas/Labels'
lastRunError:
readOnly: true
type: string
lastRunStatus:
enum:
- failed
- success
- canceled
readOnly: true
type: string
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.
format: date-time
readOnly: true
type: string
links:
example:
labels: /api/v2/tasks/1/labels
logs: /api/v2/tasks/1/logs
members: /api/v2/tasks/1/members
owners: /api/v2/tasks/1/owners
runs: /api/v2/tasks/1/runs
self: /api/v2/tasks/1
properties:
labels:
$ref: '#/components/schemas/Link'
logs:
$ref: '#/components/schemas/Link'
members:
$ref: '#/components/schemas/Link'
owners:
$ref: '#/components/schemas/Link'
runs:
$ref: '#/components/schemas/Link'
self:
$ref: '#/components/schemas/Link'
readOnly: true
type: object
name:
description: The name of the task.
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.
format: duration
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
orgID:
description: 'An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID.
Specifies the organization that owns 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
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
status:
$ref: '#/components/schemas/TaskStatusType'
updatedAt:
format: date-time
readOnly: true
type: string
required:
- id
- name
- orgID
type: object
Link:
description: URI of resource.
format: uri
readOnly: true
type: string
ErrorCode:
description: code is the machine-readable error code.
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
readOnly: true
type: string
LabelResponse:
properties:
label:
$ref: '#/components/schemas/Label'
links:
$ref: '#/components/schemas/Links'
type: object
TaskCreateRequest:
properties:
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
description:
description: The description 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
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
name:
description: The name of the task
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.
format: duration
type: string
org:
description: The name of the organization that owns the task.
type: string
orgID:
description: The ID of the organization that owns 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
status:
$ref: '#/components/schemas/TaskStatusType'
type: object
ResourceOwner:
allOf:
- $ref: '#/components/schemas/UserResponse'
- properties:
role:
default: owner
enum:
- owner
type: string
type: object
ResourceMembers:
properties:
links:
properties:
self:
format: uri
type: string
type: object
users:
items:
$ref: '#/components/schemas/ResourceMember'
type: array
type: object
UserResponse:
properties:
id:
description: 'The user ID.
'
readOnly: true
type: string
links:
example:
self: /api/v2/users/1
properties:
self:
format: uri
type: string
readOnly: true
type: object
name:
description: 'The user name.
'
type: string
status:
default: active
description: 'The status of a user.
An inactive user can''t read or write resources.
'
enum:
- active
- inactive
type: string
required:
- name
TaskUpdateRequest:
properties:
cron:
description: Update the 'cron' option in the flux script.
type: string
description:
description: Update the description of the task.
type: string
every:
description: Update the 'every' option in the flux script.
type: string
flux:
description: Update the Flux script that the task runs.
type: string
name:
description: Update the 'name' option in the flux script.
type: string
offset:
description: Update the 'offset' option in the flux script.
type: string
scriptID:
description: Update the 'scriptID' of the task.
type: string
scriptParameters:
description: Update the 'scriptParameters' of the task.
type: object
status:
$ref: '#/components/schemas/TaskStatusType'
type: object
Label:
properties:
id:
readOnly: true
type: string
name:
type: string
orgID:
readOnly: true
type: string
properties:
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
type: object
type: object
Run:
properties:
finishedAt:
description: The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run finished executing.
example: 2006-01-02T15:04:05.999999999Z07:00
format: date-time
readOnly: true
type: string
flux:
description: Flux used for the task
readOnly: true
type: string
id:
readOnly: true
type: string
links:
example:
retry: /api/v2/tasks/1/runs/1/retry
self: /api/v2/tasks/1/runs/1
task: /api/v2/tasks/1
properties:
retry:
format: uri
type: string
self:
format: uri
type: string
task:
format: uri
type: string
readOnly: true
type: object
log:
description: An array of logs associated with the run.
items:
$ref: '#/components/schemas/LogEvent'
readOnly: true
type: array
requestedAt:
description: The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339nano-timestamp)) the run was manually requested.
example: 2006-01-02T15:04:05.999999999Z07:00
format: date-time
readOnly: true
type: string
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.
format: date-time
type: string
startedAt:
description: The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run started executing.
example: 2006-01-02T15:04:05.999999999Z07:00
format: date-time
readOnly: true
type: string
status:
enum:
- scheduled
- started
- failed
- success
- canceled
readOnly: true
type: string
taskID:
readOnly: true
type: string
Labels:
items:
$ref: '#/components/schemas/Label'
type: array
Error:
properties:
code:
$ref: '#/components/schemas/ErrorCode'
description: code is the machine-readable error code.
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
readOnly: true
type: string
err:
description: Stack of errors that occurred during processing of the request. Useful for debugging.
readOnly: true
type: string
message:
description: Human-readable message.
readOnly: true
type: string
op:
description: Describes the logical code operation when the error occurred. Useful for debugging.
readOnly: true
type: string
required:
- code
LogEvent:
properties:
message:
description: A description of the event that occurred.
example: Halt and catch fire
readOnly: true
type: string
runID:
description: The ID of the task run that generated the event.
readOnly: true
type: string
time:
description: The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339nano-timestamp)) that the event occurred.
example: 2006-01-02T15:04:05.999999999Z07:00
format: date-time
readOnly: true
type: string
type: object
ResourceMember:
allOf:
- $ref: '#/components/schemas/UserResponse'
- properties:
role:
default: member
enum:
- member
type: string
type: object
RunManually:
properties:
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.
Default is the server _now_ time.
'
format: date-time
nullable: true
type: string
Links:
description: 'URI pointers for additional paged results.
'
properties:
next:
$ref: '#/components/schemas/Link'
prev:
$ref: '#/components/schemas/Link'
self:
$ref: '#/components/schemas/Link'
required:
- self
type: object
TaskStatusType:
description: '`inactive` cancels scheduled runs and prevents manual runs of the task.
'
enum:
- active
- inactive
type: string
Logs:
properties:
events:
items:
$ref: '#/components/schemas/LogEvent'
readOnly: true
type: array
type: object
LabelsResponse:
properties:
labels:
$ref: '#/components/schemas/Labels'
links:
$ref: '#/components/schemas/Links'
type: object
Tasks:
properties:
links:
$ref: '#/components/schemas/Links'
readOnly: true
tasks:
items:
$ref: '#/components/schemas/Task'
type: array
type: object
Runs:
properties:
links:
$ref: '#/components/schemas/Links'
runs:
items:
$ref: '#/components/schemas/Run'
type: array
type: object
ResourceOwners:
properties:
links:
properties:
self:
format: uri
type: string
type: object
users:
items:
$ref: '#/components/schemas/ResourceOwner'
type: array
type: object
AddResourceMemberRequestBody:
properties:
id:
description: 'The ID of the user to add to the resource.
'
type: string
name:
description: 'The name of the user to add to the resource.
'
type: string
required:
- id
type: object
LabelMapping:
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
type: object
responses:
GeneralServerError:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: Non 2XX error response from server.
AuthorizationError:
content:
application/json:
examples:
tokenNotAuthorized:
summary: Token is not authorized to access a resource
value:
code: unauthorized
message: unauthorized access
schema:
properties:
code:
description: 'The HTTP status code description. Default is `unauthorized`.
'
enum:
- unauthorized
readOnly: true
type: string
message:
description: A human-readable message that may contain detail about the error.
readOnly: true
type: string
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"
BadRequestError:
content:
application/json:
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'
schema:
$ref: '#/components/schemas/Error'
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.
'
InternalServerError:
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
description: 'Internal server error.
The server encountered an unexpected situation.
'
ResourceNotFoundError:
content:
application/json:
examples:
bucket-not-found:
summary: Bucket name not found
value:
code: not found
message: bucket "air_sensor" not found
org-not-found:
summary: Organization name not found
value:
code: not found
message: organization name "my-org" not found
orgID-not-found:
summary: Organization ID not found
value:
code: not found
message: organization not found
schema:
$ref: '#/components/schemas/Error'
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"
parameters:
TraceSpan:
description: OpenTracing span context
example:
baggage:
key: value
span_id: '1'
trace_id: '1'
in: header
name: Zap-Trace-Span
required: false
schema:
type: string
securitySchemes:
BasicAuthentication:
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"
scheme: basic
type: http
TokenAuthentication:
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"
in: header
name: Authorization
type: apiKey
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: []