openapi: 3.0.0 info: title: InfluxDB OSS API Service version: 2.x description: > The InfluxDB v2 HTTP API provides a programmatic interface for all interactions with an InfluxDB v2 instance. The InfluxDB v2 HTTP API provides a programmatic interface for all interactions with an InfluxDB v2 instance. Access the InfluxDB API using `/api/v2/` and InfluxDB v1-compatible endpoints. This documentation is generated from the [InfluxDB OpenAPI specification](https://github.com/influxdata/openapi/blob/influxdb-oss-v2.7.0/contracts/ref/oss.yml). license: name: MIT url: https://opensource.org/licenses/MIT contact: name: InfluxData url: https://www.influxdata.com email: support@influxdata.com x-influxdata-short-title: v2 API servers: - url: http://localhost:8086 description: Local InfluxDB instance security: - TokenAuthentication: [] tags: - description: >- Use one of the following schemes to authenticate to the InfluxDB OSS v2 API: - [Token authentication](#section/Authentication/TokenAuthentication) - [Basic authentication](#section/Authentication/BasicAuthentication) - [Querystring authentication](#section/Authentication/QuerystringAuthentication) name: Authentication x-traitTag: true - description: >- Create and manage API token authorizations that grant read and write permissions to InfluxDB OSS v2 organization resources. name: Authorizations (API tokens) x-related: - title: Manage API tokens href: https://docs.influxdata.com/influxdb/v2/security/tokens/ - name: Authorizations (v1-compatible) description: Manage v1-compatible legacy authorization credentials in InfluxDB OSS v2. - name: Backup description: >- Back up InfluxDB OSS v2 data, including time series data and metadata, for use in restore operations. - description: >- Create and manage named storage locations (buckets) in InfluxDB OSS v2, each with a configurable retention period. name: Buckets x-related: - title: Manage buckets href: https://docs.influxdata.com/influxdb/v2/organizations/buckets/ - name: Cells description: Manage cells within InfluxDB OSS v2 dashboards. - name: Checks description: >- Create and manage monitoring checks that query data on a schedule and generate notification statuses in InfluxDB OSS v2. - description: >- Most InfluxDB OSS v2 API endpoints require parameters in the request--for example, to specify the bucket or organization. The following table shows common query parameters used by many InfluxDB OSS v2 API endpoints. | Query parameter | Value type | Description | |:----------------|:-----------|:---------------------------------------------| | `bucket` | string | The bucket name. | | `bucketID` | string | The bucket ID. | | `org` | string | The organization name. | | `orgID` | string | The organization ID. | | `precision` | string | Timestamp precision: `ns`, `us`, `ms`, `s`. | | `db` | string | The database (for v1-compatible endpoints). | name: Common parameters x-traitTag: true - name: Compatibility endpoints description: >- InfluxDB v1-compatible API endpoints for backward compatibility with InfluxDB 1.x clients, tools, and integrations such as Grafana and Telegraf. x-traitTag: true - name: Config description: Retrieve configuration information for an InfluxDB OSS v2 instance. - name: Dashboards description: Create and manage dashboards in InfluxDB OSS v2. - description: >- Manage database and retention policy (DBRP) mappings that route InfluxDB v1-compatible requests to InfluxDB OSS v2 buckets. name: DBRPs x-related: - title: Database and retention policy mapping href: >- https://docs.influxdata.com/influxdb/v2/reference/api/influxdb-1x/dbrp/ - description: >- Generate Go runtime profiling and trace reports for troubleshooting and performance analysis of an InfluxDB OSS v2 instance. name: Debug - description: >- Delete time series data from an InfluxDB OSS v2 bucket by specifying a time range and optional tag predicate. name: Delete - description: >- InfluxDB OSS v2 API endpoints use standard HTTP request and response headers. The following table shows common headers used by many InfluxDB OSS v2 API endpoints. Some endpoints may use other headers for functions specific to those endpoints--for example, the write endpoints accept the `Content-Encoding` header to indicate that line protocol is compressed in the request body. | Header | Value type | Description | |:-------------------|:-----------|:------------------------------------------------------| | `Accept` | string | The content type that the client can understand. | | `Authorization` | string | The authorization scheme and credential. | | `Content-Encoding` | string | Compression applied to the request body (e.g., gzip). | | `Content-Length` | integer | The size of the entity-body, in bytes. | | `Content-Type` | string | The format of the data in the request body. | name: Headers x-traitTag: true - name: Health description: Check the health and readiness of an InfluxDB OSS v2 instance. - name: Labels description: >- Create and manage labels for organizing InfluxDB OSS v2 resources such as dashboards, tasks, and buckets. - name: Metrics description: >- Retrieve internal metrics for an InfluxDB OSS v2 instance in Prometheus exposition format. - name: NotificationEndpoints description: >- Create and manage notification endpoints that receive alert notifications from InfluxDB OSS v2 monitoring checks. - name: NotificationRules description: >- Create and manage notification rules that define when and how InfluxDB OSS v2 sends notifications to configured endpoints. - description: >- Create and manage InfluxDB OSS v2 organizations, which are workspaces that group users, buckets, and resources. name: Organizations x-related: - title: Manage organizations href: https://docs.influxdata.com/influxdb/v2/organizations/ - description: >- List endpoints in the InfluxDB OSS v2 API support pagination via query parameters. Use these parameters to page through large result sets. | Query parameter | Value type | Description | |:----------------|:-----------|:----------------------------------------------------| | `limit` | integer | Maximum number of records to return (default: 20). | | `offset` | integer | Number of records to skip before returning results. | | `after` | string | Return records created after the specified record ID. | | `descending` | boolean | Sort results in descending order. | List responses include pagination metadata (such as total count or links to the next page) to help navigate through result pages. name: Pagination x-traitTag: true - name: Ping description: Check the availability of an InfluxDB OSS v2 instance. - description: >- Retrieve data, analyze queries, and get query suggestions using the InfluxDB OSS v2 query API. name: Query data x-related: - title: Query data href: https://docs.influxdata.com/influxdb/v2/query-data/ - name: Query data (v1-compatible) description: >- Query data in InfluxDB OSS v2 using InfluxQL via the v1-compatible `/query` endpoint. - description: >- Authenticate, write, and query with the InfluxDB OSS v2 API: 1. Create an API token with write and read permissions for a bucket. For new installations, set up InfluxDB and create the initial admin token during the [onboarding process](https://docs.influxdata.com/influxdb/v2/install/). 2. Check the status of the InfluxDB server. ```bash curl "http://localhost:8086/health" ``` 3. Write data to a bucket using the `/api/v2/write` endpoint and [line protocol](https://docs.influxdata.com/influxdb/v2/reference/syntax/line-protocol/). ```bash curl --request POST \ "http://localhost:8086/api/v2/write?org=ORG&bucket=BUCKET&precision=s" \ --header "Authorization: Token YOUR_API_TOKEN" \ --header "Content-Type: text/plain; charset=utf-8" \ --data-raw "home,room=Kitchen temp=72.0 1640995200 home,room=Living\ Room temp=71.5 1640995200" ``` If all data is written, the response is `204 No Content`. 4. Query data using the Flux `/api/v2/query` endpoint. ```bash curl --request POST \ "http://localhost:8086/api/v2/query?org=ORG" \ --header "Authorization: Token YOUR_API_TOKEN" \ --header "Content-Type: application/vnd.flux" \ --data 'from(bucket: "BUCKET") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "home")' ``` Alternatively, query with InfluxQL using the v1-compatible `/query` endpoint. Target a v1 DBRP mapping (`database.retention_policy`) that points to your bucket: ```bash curl --get "http://localhost:8086/query" \ --header "Authorization: Token YOUR_API_TOKEN" \ --data-urlencode "db=DATABASE" \ --data-urlencode "q=SELECT * FROM home WHERE time > now() - 1h" ``` For more information, see [Get started with InfluxDB OSS v2](https://docs.influxdata.com/influxdb/v2/get-started/). name: Quick start x-traitTag: true x-related: - title: Get started with InfluxDB OSS v2 href: https://docs.influxdata.com/influxdb/v2/get-started/ - title: Write data href: https://docs.influxdata.com/influxdb/v2/write-data/ - title: Query data with Flux href: https://docs.influxdata.com/influxdb/v2/query-data/ - name: Ready description: Check whether an InfluxDB OSS v2 instance is ready to accept requests. - name: RemoteConnections description: >- Create and manage remote InfluxDB connections for replicating data from an InfluxDB OSS v2 instance to a remote InfluxDB instance. - name: Replications description: >- Create and manage replication streams that copy data from an InfluxDB OSS v2 bucket to a remote InfluxDB instance. - name: Resources description: >- Retrieve a list of top-level resource types available in the InfluxDB OSS v2 API. - description: >- InfluxDB OSS v2 API endpoints return standard HTTP status codes. The following table summarizes the most common response codes. | Status code | Meaning | |:------------|:------------------------------------------------------------------------| | `200 OK` | Success. | | `201 Created` | The resource was created. | | `204 No Content` | Success with no response body (typically after write or delete). | | `400 Bad Request` | Request parameters or body are malformed or invalid. | | `401 Unauthorized` | Missing or invalid credentials. | | `403 Forbidden` | Credentials lack permission for the requested resource. | | `404 Not Found` | The requested resource does not exist. | | `413 Payload Too Large` | Request body exceeds the maximum allowed size. | | `422 Unprocessable Entity` | Request body is well-formed but semantically invalid. | | `429 Too Many Requests` | Rate limit exceeded. | | `500 Internal Server Error` | Unexpected server error. | | `503 Service Unavailable` | Server is overloaded or under maintenance. | name: Response codes x-traitTag: true - name: Restore description: >- Restore InfluxDB OSS v2 data from a backup, including time series data and metadata. - name: Routes description: Retrieve top-level routes for the InfluxDB OSS v2 API. - name: Rules description: Manage notification rules in InfluxDB OSS v2. - name: Scraper Targets description: >- Create and manage Prometheus scraper targets that collect metrics and write them to InfluxDB OSS v2 buckets. - name: Secrets description: >- Create and manage secrets (key-value pairs) for use in InfluxDB OSS v2 Flux scripts and tasks. - name: Security and access endpoints description: >- Endpoints for managing authentication and access control in InfluxDB OSS v2. - name: Setup description: >- Configure a new InfluxDB OSS v2 instance, including creating the initial user, organization, bucket, and API token. x-related: - title: Set up InfluxDB href: https://docs.influxdata.com/influxdb/v2/get-started/ - name: Signin description: >- Create a user session by signing in with username and password credentials. - name: Signout description: End a user session by signing out. - name: Sources description: Manage data sources configured in InfluxDB OSS v2. - description: >- The InfluxDB OSS v2 API supports create, read, update, and delete operations on resources. Most endpoints follow standard HTTP method conventions: | Operation | HTTP Method | Description | |:----------|:------------|:------------| | **Write** | `POST` | Send data or create a resource. | | **Read** | `GET` | Retrieve a resource or list resources. | | **Update** | `PUT`, `PATCH` | Replace or modify an existing resource. | | **Delete** | `DELETE` | Remove a resource. | name: Supported operations x-traitTag: true - name: System information endpoints description: >- Endpoints for retrieving system-level information about the InfluxDB OSS v2 instance. - description: >- Schedule and manage Flux tasks that process and transform data on a recurring basis in InfluxDB OSS v2. name: Tasks x-related: - title: Get started with tasks href: https://docs.influxdata.com/influxdb/v2/process-data/get-started/ - name: Telegraf Plugins description: >- Retrieve available Telegraf plugin configuration templates for use with InfluxDB OSS v2. - name: Telegrafs description: >- Create and manage Telegraf agent configurations that collect and write data to InfluxDB OSS v2. - description: >- Export and apply InfluxDB templates, and manage template stacks for InfluxDB OSS v2. name: Templates x-related: - title: InfluxDB templates href: https://docs.influxdata.com/influxdb/v2/influxdb-templates/ - description: >- Create and manage users that have access to InfluxDB OSS v2 organizations and resources. name: Users x-related: - title: Manage users href: https://docs.influxdata.com/influxdb/v2/users/ - name: Variables description: Create and manage variables for use in InfluxDB OSS v2 dashboards. - name: Views description: Manage cell views within InfluxDB OSS v2 dashboards. - description: >- Write time series data to InfluxDB OSS v2 buckets in line protocol format using the `/api/v2/write` endpoint. name: Write data x-related: - title: Write data href: https://docs.influxdata.com/influxdb/v2/write-data/ - name: Write data (v1-compatible) description: >- Write data to InfluxDB OSS v2 using the v1-compatible `/write` endpoint with line protocol. paths: /api/v2: get: description: | Retrieves all the top level routes for the InfluxDB API. #### Limitations - Only returns top level routes--for example, the response contains `"tasks":"/api/v2/tasks"`, and doesn't contain resource-specific routes for tasks (`/api/v2/tasks/TASK_ID/...`). operationId: GetRoutes parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/Routes' description: > Success. The response body contains key-value pairs with the resource name and top-level route. summary: List all top level routes tags: - Routes - System information endpoints /api/v2/authorizations: get: description: > Lists authorizations. To limit which authorizations are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all authorizations. #### InfluxDB Cloud - InfluxDB Cloud doesn't expose [API token](https://docs.influxdata.com/influxdb/v2/reference/glossary/#token) values in `GET /api/v2/authorizations` responses; returns `token: redacted` for all authorizations. #### Required permissions To retrieve an authorization, the request must use an API token that has the following permissions: - `read-authorizations` - `read-user` for the user that the authorization is scoped to #### Related guides - [View tokens](https://docs.influxdata.com/influxdb/v2/security/tokens/view-tokens/) operationId: GetAuthorizations parameters: - $ref: '#/components/parameters/TraceSpan' - description: > A user ID. Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). in: query name: userID schema: type: string - description: > A user name. Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). in: query name: user schema: type: string - description: >- An organization ID. Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization). in: query name: orgID schema: type: string - description: > An organization name. Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization). in: query name: org schema: type: string - description: > An API [token](https://docs.influxdata.com/influxdb/v2/reference/glossary/#token) value. Specifies an authorization by its `token` property value and returns the authorization. #### InfluxDB OSS v2 - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, applies other parameters, and then returns the result. #### Limitations - The parameter is non-repeatable. If you specify more than one, only the first one is used. If a resource with the specified property value doesn't exist, then the response body contains an empty list. in: query name: token schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Authorizations' description: > Success. The response body contains a list of authorizations. If the response body is missing authorizations that you expect, check that the API token used in the request has `read-user` permission for the users (`userID` property value) in those authorizations. #### InfluxDB OSS v2 - **Warning**: The response body contains authorizations with their [API token](https://docs.influxdata.com/influxdb/v2/reference/glossary/#token) values in clear text. - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/v2/security/tokens/#operator-token)_, InfluxDB OSS returns authorizations for all organizations in the instance. '400': $ref: '#/components/responses/GeneralServerError' description: Invalid request '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: List authorizations tags: - Authorizations (API tokens) - Security and access endpoints post: description: > Creates an authorization and returns the authorization with the generated API [token](https://docs.influxdata.com/influxdb/v2/reference/glossary/#token). Use this endpoint to create an authorization, which generates an API token with permissions to `read` or `write` to a specific resource or `type` of resource. The API token is the authorization's `token` property value. To follow best practices for secure API token generation and retrieval, InfluxDB enforces access restrictions on API tokens. - InfluxDB allows access to the API token value immediately after the authorization is created. - You can’t change access (read/write) permissions for an API token after it’s created. - Tokens stop working when the user who created the token is deleted. 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. #### Required permissions - `write-authorizations` - `write-user` for the user that the authorization is scoped to #### Related guides - [Create a token](https://docs.influxdata.com/influxdb/v2/security/tokens/create-token/) operationId: PostAuthorizations parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: examples: AuthorizationPostRequest: $ref: '#/components/examples/AuthorizationPostRequest' AuthorizationWithResourcePostRequest: $ref: '#/components/examples/AuthorizationWithResourcePostRequest' AuthorizationWithUserPostRequest: $ref: '#/components/examples/AuthorizationWithUserPostRequest' schema: $ref: '#/components/schemas/AuthorizationPostRequest' description: The authorization to create. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Authorization' description: > Success. The authorization is created. The response body contains the authorization. '400': $ref: '#/components/responses/GeneralServerError' description: Invalid request '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Create an authorization tags: - Authorizations (API tokens) - Security and access endpoints /api/v2/authorizations/{authID}: delete: description: > Deletes an authorization. Use the endpoint to delete an API token. If you want to disable an API token instead of delete it, [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). operationId: DeleteAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: An authorization ID. Specifies the authorization to delete. in: path name: authID required: true schema: type: string responses: '204': description: Success. The authorization is deleted. '400': content: application/json: examples: notFound: summary: | The specified resource ID is invalid. value: code: invalid message: id must have a length of 16 bytes schema: $ref: '#/components/schemas/Error' description: | Bad request. '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested authorization doesn't exist. value: code: not found message: authorization not found schema: $ref: '#/components/schemas/Error' description: | Not found. '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Delete an authorization tags: - Authorizations (API tokens) - Security and access endpoints get: description: > Retrieves an authorization. Use this endpoint to retrieve information about an API token, including the token's permissions and the user that the token is scoped to. #### InfluxDB OSS v2 - InfluxDB OSS returns [API token](https://docs.influxdata.com/influxdb/v2/reference/glossary/#token) values in authorizations. - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/v2/security/tokens/#operator-token)_, InfluxDB OSS returns authorizations for all organizations in the instance. #### Related guides - [View tokens](https://docs.influxdata.com/influxdb/v2/security/tokens/view-tokens/) externalDocs: description: View tokens url: https://docs.influxdata.com/influxdb/v2/security/tokens/view-tokens/ operationId: GetAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: An authorization ID. Specifies the authorization to retrieve. in: path name: authID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Authorization' description: Success. The response body contains the authorization. '400': content: application/json: examples: notFound: summary: | The specified resource ID is invalid. value: code: invalid message: id must have a length of 16 bytes schema: $ref: '#/components/schemas/Error' description: | Bad request. '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested authorization doesn't exist. value: code: not found message: authorization not found schema: $ref: '#/components/schemas/Error' description: | Not found. '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Retrieve an authorization tags: - Authorizations (API tokens) - Security and access endpoints patch: description: > Updates an authorization. Use this endpoint to set an API token's status to be _active_ or _inactive_. InfluxDB rejects requests that use inactive API tokens. operationId: PatchAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: An authorization ID. Specifies the authorization to update. in: path name: authID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AuthorizationUpdateRequest' description: In the request body, provide the authorization properties to update. required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Authorization' description: Success. The response body contains the updated authorization. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Update an API token to be active or inactive tags: - Authorizations (API tokens) - Security and access endpoints /api/v2/backup/kv: get: deprecated: true description: > Retrieves a snapshot of metadata stored in the server's embedded KV store. InfluxDB versions greater than 2.1.x don't include metadata stored in embedded SQL; avoid using this endpoint with versions greater than 2.1.x. operationId: GetBackupKV parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/octet-stream: schema: format: binary type: string description: Success. The response contains a snapshot of KV metadata. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: >- Download snapshot of metadata stored in the server's embedded KV store. Don't use with InfluxDB versions greater than InfluxDB 2.1.x. tags: - Backup /api/v2/backup/metadata: get: operationId: GetBackupMetadata parameters: - $ref: '#/components/parameters/TraceSpan' - description: >- Indicates the content encoding (usually a compression algorithm) that the client can understand. in: header name: Accept-Encoding schema: default: identity description: >- The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string responses: '200': content: multipart/mixed: schema: $ref: '#/components/schemas/MetadataBackup' description: Snapshot of metadata headers: Content-Encoding: description: >- Lists any encodings (usually compression algorithms) that have been applied to the response payload. schema: default: identity description: > The content coding: `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Download snapshot of all metadata in the server tags: - Backup /api/v2/backup/shards/{shardID}: get: operationId: GetBackupShardId parameters: - $ref: '#/components/parameters/TraceSpan' - description: >- Indicates the content encoding (usually a compression algorithm) that the client can understand. in: header name: Accept-Encoding schema: default: identity description: >- The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string - description: The shard ID. in: path name: shardID required: true schema: format: int64 type: integer - description: >- The earliest time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2/reference/glossary/#rfc3339-timestamp) to include in the snapshot. examples: RFC3339: summary: RFC3339 date/time format value: 2006-01-02T15:04:05Z07:00 in: query name: since schema: format: date-time type: string responses: '200': content: application/octet-stream: schema: format: binary type: string description: TSM snapshot. headers: Content-Encoding: description: >- Lists any encodings (usually compression algorithms) that have been applied to the response payload. schema: default: identity description: > The content coding: `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Shard not found. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Download snapshot of all TSM data in a shard tags: - Backup /api/v2/buckets: get: description: > Lists [buckets](https://docs.influxdata.com/influxdb/v2/reference/glossary/#bucket). InfluxDB retrieves buckets owned by the [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization) associated with the authorization ([API token](https://docs.influxdata.com/influxdb/v2/reference/glossary/#token)). To limit which buckets are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all buckets up to the default `limit`. #### InfluxDB OSS v2 - If you use an _[operator token](https://docs.influxdata.com/influxdb/v2/security/tokens/#operator-token)_ to authenticate your request, InfluxDB retrieves resources for _all organizations_ in the instance. To retrieve resources for only a specific organization, use the `org` parameter or the `orgID` parameter to specify the organization. #### Required permissions | Action | Permission required | |:--------------------------|:--------------------| | Retrieve _user buckets_ | `read-buckets` | | Retrieve [_system buckets_](https://docs.influxdata.com/influxdb/v2/reference/internals/system-buckets/) | `read-orgs` | #### Related Guides - [Manage buckets](https://docs.influxdata.com/influxdb/v2/organizations/buckets/) operationId: GetBuckets parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/After' - description: > An organization name. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Lists buckets for the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Lists buckets for the specified organization. in: query name: org schema: type: string - description: > An organization ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Lists buckets for the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or `orgID` parameter. - Lists buckets for the specified organization. in: query name: orgID schema: type: string - description: | A bucket name. Only returns buckets with the specified name. in: query name: name schema: type: string - description: | A bucket ID. Only returns the bucket with the specified ID. in: query name: id schema: type: string responses: '200': content: application/json: examples: successResponse: value: buckets: - createdAt: '2022-03-15T17:22:33.72617939Z' description: System bucket for monitoring logs id: 77ca9dace40a9bfc labels: [] links: labels: /api/v2/buckets/77ca9dace40a9bfc/labels members: /api/v2/buckets/77ca9dace40a9bfc/members org: /api/v2/orgs/INFLUX_ORG_ID owners: /api/v2/buckets/77ca9dace40a9bfc/owners self: /api/v2/buckets/77ca9dace40a9bfc write: /api/v2/write?org=ORG_ID&bucket=77ca9dace40a9bfc name: _monitoring orgID: INFLUX_ORG_ID retentionRules: - everySeconds: 604800 type: expire schemaType: implicit type: system updatedAt: '2022-03-15T17:22:33.726179487Z' links: self: >- /api/v2/buckets?descending=false&limit=20&name=_monitoring&offset=0&orgID=ORG_ID schema: $ref: '#/components/schemas/Buckets' description: | Success. The response body contains a list of `buckets`. '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List buckets tags: - Buckets x-codeSamples: - label: 'cURL: filter buckets by name' lang: Shell source: > curl --request GET "http://localhost:8086/api/v2/buckets?name=_monitoring" \ --header "Authorization: Token INFLUX_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" post: description: > Creates a [bucket](https://docs.influxdata.com/influxdb/v2/reference/glossary/#bucket) and returns the bucket resource. The default data [retention period](https://docs.influxdata.com/influxdb/v2/reference/glossary/#retention-period) is 30 days. #### InfluxDB OSS v2 - A single InfluxDB OSS instance supports active writes or queries for approximately 20 buckets across all organizations at a given time. Reading or writing to more than 20 buckets at a time can adversely affect performance. #### Limitations - InfluxDB Cloud Free Plan allows users to create up to two buckets. Exceeding the bucket quota will result in an HTTP `403` status code. For additional information regarding InfluxDB Cloud offerings, see [InfluxDB Cloud Pricing](https://www.influxdata.com/influxdb-cloud-pricing/). #### Related Guides - [Create a bucket](https://docs.influxdata.com/influxdb/v2/organizations/buckets/create-bucket/) - [Create bucket CLI reference](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/bucket/create) operationId: PostBuckets parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostBucketRequest' description: The bucket to create. required: true responses: '201': content: application/json: examples: successResponse: value: createdAt: '2022-08-03T23:04:41.073704121Z' description: A bucket holding air sensor data id: 37407e232b3911d8 labels: [] links: labels: /api/v2/buckets/37407e232b3911d8/labels members: /api/v2/buckets/37407e232b3911d8/members org: /api/v2/orgs/INFLUX_ORG_ID owners: /api/v2/buckets/37407e232b3911d8/owners self: /api/v2/buckets/37407e232b3911d8 write: /api/v2/write?org=INFLUX_ORG_ID&bucket=37407e232b3911d8 name: air_sensor orgID: INFLUX_ORG_ID retentionRules: - everySeconds: 2592000 type: expire schemaType: implicit type: user updatedAt: '2022-08-03T23:04:41.073704228Z' schema: $ref: '#/components/schemas/Bucket' description: | Success. The bucket is created. '400': content: application/json: schema: $ref: '#/components/schemas/Error' description: | Bad request. '401': $ref: '#/components/responses/AuthorizationError' '403': content: application/json: examples: quotaExceeded: summary: Bucket quota exceeded value: code: forbidden message: creating bucket would exceed quota schema: $ref: '#/components/schemas/Error' description: | Forbidden. The bucket quota is exceeded. headers: X-Platform-Error-Code: description: | The reason for the error. schema: example: forbidden type: string '422': content: application/json: schema: $ref: '#/components/schemas/Error' description: | Unprocessable Entity. The request body failed validation. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Create a bucket tags: - Buckets x-codeSamples: - label: 'cURL: create a bucket with retention period' lang: Shell source: | curl --request POST "http://localhost:8086/api/v2/buckets \ --header "Authorization: Token INFLUX_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "name": "air_sensor", "description": "A bucket holding air sensor data", "orgID": "INFLUX_ORG_ID", "retentionRules": [ { "type": "expire", "everySeconds": 2592000, } ] }' - label: cURL lang: Shell source: '' /api/v2/buckets/{bucketID}: delete: description: > Deletes a bucket and all associated records. #### InfluxDB Cloud - Does the following when you send a delete request: 1. Validates the request and queues the delete. 2. Returns an HTTP `204` status code if queued; _error_ otherwise. 3. Handles the delete asynchronously. #### InfluxDB OSS v2 - Validates the request, handles the delete synchronously, and then responds with success or failure. #### Limitations - Only one bucket can be deleted per request. #### Related Guides - [Delete a bucket](https://docs.influxdata.com/influxdb/v2/organizations/buckets/delete-bucket/#delete-a-bucket-in-the-influxdb-ui) operationId: DeleteBucketsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | Bucket ID. The ID of the bucket to delete. in: path name: bucketID required: true schema: type: string responses: '204': description: | Success. #### InfluxDB Cloud - The bucket is queued for deletion. #### InfluxDB OSS v2 - The bucket is deleted. '400': content: application/json: examples: invalidID: summary: | Invalid ID. value: code: invalid message: id must have a length of 16 bytes schema: $ref: '#/components/schemas/Error' description: | Bad Request. '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested bucket was not found. value: code: not found message: bucket not found schema: $ref: '#/components/schemas/Error' description: | Not found. Bucket not found. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a bucket tags: - Buckets x-codeSamples: - label: cURL lang: Shell source: > curl --request DELETE "http://localhost:8086/api/v2/buckets/BUCKET_ID" \ --header "Authorization: Token INFLUX_TOKEN" \ --header 'Accept: application/json' get: description: | Retrieves a bucket. Use this endpoint to retrieve information for a specific bucket. operationId: GetBucketsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the bucket to retrieve. in: path name: bucketID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: createdAt: '2022-08-03T23:04:41.073704121Z' description: bucket for air sensor data id: 37407e232b3911d8 labels: [] links: labels: /api/v2/buckets/37407e232b3911d8/labels members: /api/v2/buckets/37407e232b3911d8/members org: /api/v2/orgs/INFLUX_ORG_ID owners: /api/v2/buckets/37407e232b3911d8/owners self: /api/v2/buckets/37407e232b3911d8 write: /api/v2/write?org=INFLUX_ORG_ID&bucket=37407e232b3911d8 name: air-sensor orgID: bea7ea952287f70d retentionRules: - everySeconds: 2592000 type: expire schemaType: implicit type: user updatedAt: '2022-08-03T23:04:41.073704228Z' schema: $ref: '#/components/schemas/Bucket' description: | Success. The response body contains the bucket information. '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested bucket wasn't found. value: code: not found message: bucket not found schema: $ref: '#/components/schemas/Error' description: | Not found. Bucket not found. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a bucket tags: - Buckets patch: description: > Updates a bucket. Use this endpoint to update properties (`name`, `description`, and `retentionRules`) of a bucket. #### InfluxDB Cloud - Requires the `retentionRules` property in the request body. If you don't provide `retentionRules`, InfluxDB responds with an HTTP `403` status code. #### InfluxDB OSS v2 - Doesn't require `retentionRules`. #### Related Guides - [Update a bucket](https://docs.influxdata.com/influxdb/v2/organizations/buckets/update-bucket/) operationId: PatchBucketsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The bucket ID. in: path name: bucketID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/PatchBucketRequest' description: The bucket update to apply. required: true responses: '200': content: application/json: examples: successResponse: value: createdAt: '2022-08-03T23:04:41.073704121Z' description: bucket holding air sensor data id: 37407e232b3911d8 labels: [] links: labels: /api/v2/buckets/37407e232b3911d8/labels members: /api/v2/buckets/37407e232b3911d8/members org: /api/v2/orgs/INFLUX_ORG_ID owners: /api/v2/buckets/37407e232b3911d8/owners self: /api/v2/buckets/37407e232b3911d8 write: /api/v2/write?org=INFLUX_ORG_ID&bucket=37407e232b3911d8 name: air_sensor orgID: INFLUX_ORG_ID retentionRules: - everySeconds: 2592000 type: expire schemaType: implicit type: user updatedAt: '2022-08-07T22:49:49.422962913Z' schema: $ref: '#/components/schemas/Bucket' description: An updated bucket '400': content: application/json: examples: invalidJSONStringValue: description: > If the request body contains invalid JSON, InfluxDB returns `invalid` with detail about the problem. summary: Invalid JSON value: code: invalid message: >- invalid json: invalid character '\'' looking for beginning of value schema: $ref: '#/components/schemas/Error' description: | Bad Request. '401': $ref: '#/components/responses/AuthorizationError' '403': content: application/json: examples: invalidRetention: summary: > The retention policy provided exceeds the max retention for the organization. value: code: forbidden message: provided retention exceeds orgs maximum retention duration schema: $ref: '#/components/schemas/Error' description: | Forbidden. '404': content: application/json: examples: notFound: summary: | The requested bucket wasn't found. value: code: not found message: bucket not found schema: $ref: '#/components/schemas/Error' description: | Not found. Bucket not found. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a bucket tags: - Buckets x-codeSamples: - label: cURL lang: Shell source: > curl --request PATCH "http://localhost:8086/api/v2/buckets/BUCKET_ID \ --header "Authorization: Token INFLUX_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "name": "air_sensor", "description": "bucket holding air sensor data", "retentionRules": [ { "type": "expire", "everySeconds": 2592000 } ] }' /api/v2/buckets/{bucketID}/labels: get: description: > Lists all labels for a bucket. Labels are objects that contain `labelID`, `name`, `description`, and `color` key-value pairs. They may be used for grouping and filtering InfluxDB resources. Labels are also capable of grouping across different resources--for example, you can apply a label named `air_sensor` to a bucket and a task to quickly organize resources. #### Related guides - Use the [`/api/v2/labels` InfluxDB API endpoint](#tag/Labels) to retrieve and manage labels. - [Manage labels in the InfluxDB UI](https://docs.influxdata.com/influxdb/v2/visualize-data/labels/) operationId: GetBucketsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the bucket to retrieve labels for. in: path name: bucketID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: labels: - id: 09cbd068e7ebb000 name: production_buckets orgID: INFLUX_ORG_ID links: self: /api/v2/labels schema: $ref: '#/components/schemas/LabelsResponse' description: | Success. The response body contains a list of all labels for the bucket. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a bucket tags: - Buckets post: description: > Adds a label to a bucket and returns the new label information. Labels are objects that contain `labelID`, `name`, `description`, and `color` key-value pairs. They may be used for grouping and filtering across one or more kinds of **resources**--for example, you can apply a label named `air_sensor` to a bucket and a task to quickly organize resources. #### Limitations - Before adding a label to a bucket, you must create the label if you haven't already. To create a label with the InfluxDB API, send a `POST` request to the [`/api/v2/labels` endpoint](#operation/PostLabels)). #### Related guides - Use the [`/api/v2/labels` InfluxDB API endpoint](#tag/Labels) to retrieve and manage labels. - [Manage labels in the InfluxDB UI](https://docs.influxdata.com/influxdb/v2/visualize-data/labels/) operationId: PostBucketsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: | Bucket ID. The ID of the bucket to label. in: path name: bucketID 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 bucket. required: true responses: '201': content: application/json: examples: successResponse: value: label: id: 09cbd068e7ebb000 name: production_buckets orgID: INFLUX_ORG_ID links: self: /api/v2/labels schema: $ref: '#/components/schemas/LabelResponse' description: | Success. The response body contains the label information. '400': $ref: '#/components/responses/BadRequestError' examples: invalidRequest: summary: The `labelID` is missing from the request body. value: code: invalid message: label id is required '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '422': content: application/json: examples: conflictingResource: summary: | Label already exists on the resource. value: code: conflict message: Cannot add label, label already exists on resource schema: $ref: '#/components/schemas/Error' description: | Unprocessable entity. Label already exists on the resource. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a bucket tags: - Buckets x-codeSamples: - label: cURL lang: Shell source: > curl --request POST "http://localhost:8086/api/v2/buckets/BUCKETS_ID/labels \ --header "Authorization: Token INFLUX_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "labelID": "09cbd068e7ebb000" }' /api/v2/buckets/{bucketID}/labels/{labelID}: delete: operationId: DeleteBucketsIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The bucket ID. in: path name: bucketID 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: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Bucket not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a label from a bucket tags: - Buckets /api/v2/buckets/{bucketID}/members: get: description: > Lists all users for a bucket. InfluxDB [users](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) have permission to access InfluxDB. [Members](https://docs.influxdata.com/influxdb/v2/reference/glossary/#member) are users in an organization with access to the specified resource. Use this endpoint to retrieve all users with access to a bucket. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) - [Manage members](https://docs.influxdata.com/influxdb/v2/organizations/members/) operationId: GetBucketsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the bucket to retrieve users for. in: path name: bucketID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: links: self: /api/v2/buckets/37407e232b3911d8/members users: - id: 791df274afd48a83 links: self: /api/v2/users/791df274afd48a83 name: example_user_1 role: member status: active - id: 09cfb87051cbe000 links: self: /api/v2/users/09cfb87051cbe000 name: example_user_2 role: owner status: active schema: $ref: '#/components/schemas/ResourceMembers' description: | Success. The response body contains a list of all users for the bucket. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all users with member privileges for a bucket tags: - Buckets post: description: > Add a user to a bucket and return the new user information. InfluxDB [users](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) have permission to access InfluxDB. [Members](https://docs.influxdata.com/influxdb/v2/reference/glossary/#member) are users in an organization. Use this endpoint to give a user member privileges to a bucket. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) - [Manage members](https://docs.influxdata.com/influxdb/v2/organizations/members/) operationId: PostBucketsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the bucket to retrieve users for. in: path name: bucketID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: A user to add as a member to the bucket. required: true responses: '201': content: application/json: examples: successResponse: value: id: 09cfb87051cbe000 links: self: /api/v2/users/09cfb87051cbe000 name: example_user_1 role: member status: active schema: $ref: '#/components/schemas/ResourceMember' description: | Success. The response body contains the user information. '400': $ref: '#/components/responses/BadRequestError' examples: invalidRequest: summary: The user `id` is missing from the request body. value: code: invalid message: user id missing or invalid '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a member to a bucket tags: - Buckets x-codeSamples: - label: cURL lang: Shell source: > curl --request POST "http://localhost:8086/api/v2/buckets/BUCKET_ID/members \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "id": "09cfb87051cbe000" } /api/v2/buckets/{bucketID}/members/{userID}: delete: description: > Removes a member from a bucket. Use this endpoint to remove a user's member privileges from a bucket. This removes the user's `read` and `write` permissions for the bucket. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) - [Manage members](https://docs.influxdata.com/influxdb/v2/organizations/members/) operationId: DeleteBucketsIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the user to remove. in: path name: userID required: true schema: type: string - description: | The ID of the bucket to remove a user from. in: path name: bucketID required: true schema: type: string responses: '204': description: | Success. The user is no longer a member of the bucket. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Remove a member from a bucket tags: - Buckets /api/v2/buckets/{bucketID}/owners: get: description: > Lists all [owners](https://docs.influxdata.com/influxdb/v2/reference/glossary/#owner) of a bucket. Bucket owners have permission to delete buckets and remove user and member permissions from the bucket. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Owner permissions are separate from API token permissions. - Owner permissions are used in the context of the InfluxDB UI. #### Required permissions - `read-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a list of owners for. #### Related endpoints - [Authorizations](#tag/Authorizations-(API-tokens)) #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) operationId: GetBucketsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the bucket to retrieve owners for. in: path name: bucketID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: links: self: /api/v2/buckets/BUCKET_ID/owners users: - id: d88d182d91b0950f links: self: /api/v2/users/d88d182d91b0950f name: example-owner role: owner status: active schema: $ref: '#/components/schemas/ResourceOwners' description: | Success. The response body contains a list of all owners for the bucket. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all owners of a bucket tags: - Buckets post: description: > Adds an owner to a bucket and returns the [owners](https://docs.influxdata.com/influxdb/v2/reference/glossary/#owner) with role and user detail. Use this endpoint to create a _resource owner_ for the bucket. Bucket owners have permission to delete buckets and remove user and member permissions from the bucket. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Owner permissions are separate from API token permissions. - Owner permissions are used in the context of the InfluxDB UI. #### Required permissions - `write-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for. #### Related endpoints - [Authorizations](#tag/Authorizations-(API-tokens)) #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) operationId: PostBucketsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the bucket to add an owner for. in: path name: bucketID required: true schema: type: string requestBody: content: application/json: examples: successResponse: value: id: d88d182d91b0950f links: self: /api/v2/users/d88d182d91b0950f name: example-user role: owner status: active schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: A user to add as an owner for the bucket. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' description: | Created. The bucket `owner` role is assigned to the user. The response body contains the resource owner with role and user detail. '400': $ref: '#/components/responses/BadRequestError' examples: invalidRequest: summary: The user `id` is missing from the request body. value: code: invalid message: user id missing or invalid '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add an owner to a bucket tags: - Buckets x-codeSamples: - label: cURL lang: Shell source: > curl --request POST "http://localhost:8086/api/v2/buckets/BUCKET_ID/owners \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "id": "09cfb87051cbe000" } /api/v2/buckets/{bucketID}/owners/{userID}: delete: description: > Removes an owner from a bucket. Use this endpoint to remove a user's `owner` role for a bucket. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Owner permissions are separate from API token permissions. - Owner permissions are used in the context of the InfluxDB UI. #### Required permissions - `write-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner from. #### Related endpoints - [Authorizations](#tag/Authorizations-(API-tokens)) #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) operationId: DeleteBucketsIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the owner to remove. in: path name: userID required: true schema: type: string - description: | The ID of the bucket to remove an owner from. in: path name: bucketID required: true schema: type: string responses: '204': description: | Success. The user is no longer an owner of the bucket. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Remove an owner from a bucket tags: - Buckets /api/v2/checks: get: operationId: GetChecks parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - description: Only show checks that belong to a specific organization ID. in: query name: orgID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Checks' description: A list of checks default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all checks tags: - Checks post: operationId: CreateCheck requestBody: content: application/json: schema: $ref: '#/components/schemas/PostCheck' description: Check to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Check' description: Check created default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add new check tags: - Checks /api/v2/checks/{checkID}: delete: operationId: DeleteChecksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The check was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a check tags: - Checks get: operationId: GetChecksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Check' description: The check requested default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a check tags: - Checks patch: operationId: PatchChecksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/CheckPatch' description: Check update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Check' description: An updated check '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The check was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a check tags: - Checks put: operationId: PutChecksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Check' description: Check update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Check' description: An updated check '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The check was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a check tags: - Checks /api/v2/checks/{checkID}/labels: get: operationId: GetChecksIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of all labels for a check default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a check tags: - Checks post: operationId: PostChecksIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The label was added to the check default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a check tags: - Checks /api/v2/checks/{checkID}/labels/{labelID}: delete: operationId: DeleteChecksIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID 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: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Check or label not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete label from a check tags: - Checks /api/v2/checks/{checkID}/query: get: operationId: GetChecksIDQuery parameters: - $ref: '#/components/parameters/TraceSpan' - description: The check ID. in: path name: checkID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/FluxResponse' description: The check query requested '400': content: application/json: schema: $ref: '#/components/schemas/Error' description: Invalid request '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Check not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a check query tags: - Checks /api/v2/config: get: description: > Returns the active runtime configuration of the InfluxDB instance. In InfluxDB v2.2+, use this endpoint to view your active runtime configuration, including flags and environment variables. #### Related guides - [View your runtime server configuration](https://docs.influxdata.com/influxdb/v2/reference/config-options/#view-your-runtime-server-configuration) operationId: GetConfig parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/Config' description: > Success. The response body contains the active runtime configuration of the InfluxDB instance. '401': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Retrieve runtime configuration tags: - Config - System information endpoints /api/v2/dashboards: get: description: > Lists [dashboards](https://docs.influxdata.com/influxdb/v2/reference/glossary/#dashboard). #### Related guides - [Manage dashboards](https://docs.influxdata.com/influxdb/v2/visualize-data/dashboards/). operationId: GetDashboards parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Descending' - description: >- A user ID. Only returns [dashboards](https://docs.influxdata.com/influxdb/v2/reference/glossary/#dashboard) where the specified user has the `owner` role. in: query name: owner schema: type: string - description: The column to sort by. in: query name: sortBy schema: enum: - ID - CreatedAt - UpdatedAt type: string - description: > A list of dashboard IDs. Returns only the specified [dashboards](https://docs.influxdata.com/influxdb/v2/reference/glossary/#dashboard). If you specify `id` and `owner`, only `id` is used. in: query name: id schema: items: type: string type: array - description: > An organization ID. Only returns [dashboards](https://docs.influxdata.com/influxdb/v2/reference/glossary/#dashboard) that belong to the specified [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization). in: query name: orgID schema: type: string - description: > An organization name. Only returns [dashboards](https://docs.influxdata.com/influxdb/v2/reference/glossary/#dashboard) that belong to the specified [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization). in: query name: org schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Dashboards' description: Success. The response body contains dashboards. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List dashboards tags: - Dashboards post: operationId: PostDashboards parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateDashboardRequest' description: Dashboard to create required: true responses: '201': content: application/json: schema: oneOf: - $ref: '#/components/schemas/Dashboard' - $ref: '#/components/schemas/DashboardWithViewProperties' description: Success. The dashboard is created. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Create a dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}: delete: operationId: DeleteDashboardsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a dashboard tags: - Dashboards get: operationId: GetDashboardsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string - description: If `properties`, includes the cell view properties in the response. in: query name: include required: false schema: enum: - properties type: string responses: '200': content: application/json: schema: oneOf: - $ref: '#/components/schemas/Dashboard' - $ref: '#/components/schemas/DashboardWithViewProperties' description: Retrieve a single dashboard '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a dashboard tags: - Dashboards patch: operationId: PatchDashboardsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string requestBody: content: application/json: schema: properties: cells: $ref: '#/components/schemas/CellWithViewProperties' description: >- optional, when provided will replace all existing cells with the cells provided description: description: optional, when provided will replace the description type: string name: description: optional, when provided will replace the name type: string title: PatchDashboardRequest type: object description: Patching of a dashboard required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Dashboard' description: Updated dashboard '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}/cells: post: operationId: PostDashboardsIDCells parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateCell' description: Cell that will be added required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Cell' description: Cell successfully added '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Create a dashboard cell tags: - Cells - Dashboards put: description: >- Replaces all cells in a dashboard. This is used primarily to update the positional information of all cells. operationId: PutDashboardsIDCells parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Cells' required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Dashboard' description: Replaced dashboard cells '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Replace cells in a dashboard tags: - Cells - Dashboards /api/v2/dashboards/{dashboardID}/cells/{cellID}: delete: operationId: DeleteDashboardsIDCellsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to delete. in: path name: dashboardID required: true schema: type: string - description: The ID of the cell to delete. in: path name: cellID required: true schema: type: string responses: '204': description: Cell successfully deleted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Cell or dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a dashboard cell tags: - Cells - Dashboards patch: description: >- Updates the non positional information related to a cell. Updates to a single cell's positional data could cause grid conflicts. operationId: PatchDashboardsIDCellsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string - description: The ID of the cell to update. in: path name: cellID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/CellUpdate' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Cell' description: Updated dashboard cell '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Cell or dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update the non-positional information related to a cell tags: - Cells - Dashboards /api/v2/dashboards/{dashboardID}/cells/{cellID}/view: get: operationId: GetDashboardsIDCellsIDView parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string - description: The cell ID. in: path name: cellID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/View' description: A dashboard cells view '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Cell or dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve the view for a cell tags: - Cells - Dashboards - Views patch: operationId: PatchDashboardsIDCellsIDView parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the dashboard to update. in: path name: dashboardID required: true schema: type: string - description: The ID of the cell to update. in: path name: cellID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/View' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/View' description: Updated cell view '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Cell or dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update the view for a cell tags: - Cells - Dashboards - Views /api/v2/dashboards/{dashboardID}/labels: get: operationId: GetDashboardsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of all labels for a dashboard default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a dashboard tags: - Dashboards post: operationId: PostDashboardsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The label added to the dashboard default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}/labels/{labelID}: delete: operationId: DeleteDashboardsIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID 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: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Dashboard not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a label from a dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}/members: get: operationId: GetDashboardsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResourceMembers' description: A list of users who have member privileges for a dashboard default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all dashboard members tags: - Dashboards post: operationId: PostDashboardsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: User to add as member required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceMember' description: Added to dashboard members default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a member to a dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}/members/{userID}: delete: operationId: DeleteDashboardsIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the member to remove. in: path name: userID required: true schema: type: string - description: The dashboard ID. in: path name: dashboardID 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 dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}/owners: get: operationId: GetDashboardsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResourceOwners' description: A list of users who have owner privileges for a dashboard default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all dashboard owners tags: - Dashboards post: operationId: PostDashboardsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The dashboard ID. in: path name: dashboardID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: User to add as owner required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' description: Added to dashboard owners default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add an owner to a dashboard tags: - Dashboards /api/v2/dashboards/{dashboardID}/owners/{userID}: delete: operationId: DeleteDashboardsIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the owner to remove. in: path name: userID required: true schema: type: string - description: The dashboard ID. in: path name: dashboardID 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 dashboard tags: - Dashboards /api/v2/dbrps: get: description: > Lists database retention policy (DBRP) mappings. #### Related guide - [Database and retention policy mapping](https://docs.influxdata.com/influxdb/v2/reference/api/influxdb-1x/dbrp/) operationId: GetDBRPs parameters: - $ref: '#/components/parameters/TraceSpan' - description: | An organization ID. Only returns DBRP mappings for the specified organization. in: query name: orgID schema: type: string - description: | An organization name. Only returns DBRP mappings for the specified organization. in: query name: org schema: type: string - description: | A DBPR mapping ID. Only returns the specified DBRP mapping. in: query name: id schema: type: string - description: | A bucket ID. Only returns DBRP mappings that belong to the specified bucket. in: query name: bucketID schema: type: string - description: Specifies filtering on default in: query name: default schema: type: boolean - description: | A database. Only returns DBRP mappings that belong to the 1.x database. in: query name: db schema: type: string - description: > A [retention policy](https://docs.influxdata.com/influxdb/v2/reference/glossary/#retention-policy-rp). Specifies the 1.x retention policy to filter on. in: query name: rp schema: type: string responses: '200': content: application/json: examples: successResponse: value: content: - bucketID: 4d4d9d5b61dee751 database: example_database_1 default: true id: 0a3cbb5dd526a000 orgID: bea7ea952287f70d retention_policy: autogen - bucketID: 4d4d9d5b61dee751 database: example_database_2 default: false id: 0a3cbcde20e38000 orgID: bea7ea952287f70d retention_policy: example_retention_policy schema: $ref: '#/components/schemas/DBRPs' description: >- Success. The response body contains a list of database retention policy mappings. '400': content: application/json: examples: invalidRequest: description: | The query parameters contain invalid values. value: code: invalid message: invalid ID schema: $ref: '#/components/schemas/Error' description: Bad request. The request has one or more invalid parameters. '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List database retention policy mappings tags: - DBRPs post: description: > Creates a database retention policy (DBRP) mapping and returns the mapping. Use this endpoint to add InfluxDB 1.x API compatibility to your InfluxDB Cloud or InfluxDB OSS 2.x buckets. Your buckets must contain a DBRP mapping in order to query and write using the InfluxDB 1.x API. object. #### Related guide - [Database and retention policy mapping](https://docs.influxdata.com/influxdb/v2/reference/api/influxdb-1x/dbrp/) operationId: PostDBRP parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/DBRPCreate' description: > The database retention policy mapping to add. Note that _`retention_policy`_ is a required parameter in the request body. The value of _`retention_policy`_ can be any arbitrary `string` name or value, with the default value commonly set as `autogen`. The value of _`retention_policy`_ isn't a [retention_policy](https://docs.influxdata.com/influxdb/v2/reference/glossary/#retention-policy-rp) required: true responses: '201': content: application/json: examples: successResponse: value: bucketID: 4d4d9d5b61dee751 database: example_database default: true id: 0a3cbb5dd526a000 orgID: bea7ea952287f70d retention_policy: autogen schema: $ref: '#/components/schemas/DBRP' description: >- Created. The response body contains the database retention policy mapping. '400': content: application/json: examples: invalidRequest: description: | The query parameters contain invalid values. value: code: invalid message: invalid ID schema: $ref: '#/components/schemas/Error' description: Bad request. The mapping in the request has one or more invalid IDs. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a database retention policy mapping tags: - DBRPs x-codeSamples: - label: 'cURL: create a database retention policy mapping' lang: Shell source: | curl --request POST \ "http://localhost:8086/api/v2/dbrp/" \ --header 'Content-type: application/json' \ --header "Authorization: Token INFLUXDB_TOKEN" \ --data-binary @- << EOF { \ "bucketID": "INFLUXDB_BUCKET_ID", \ "orgID": "INFLUXDB_ORG_ID", \ "database": "database_name", \ "default": true, \ "retention_policy": "example_retention_policy_name" \ } EOF /api/v2/dbrps/{dbrpID}: delete: description: > Deletes the specified database retention policy (DBRP) mapping. #### Related guide - [Database and retention policy mapping](https://docs.influxdata.com/influxdb/v2/reference/api/influxdb-1x/dbrp/) operationId: DeleteDBRPID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | An organization ID. Specifies the organization that owns the DBRP mapping. in: query name: orgID schema: type: string - description: | An organization name. Specifies the organization that owns the DBRP mapping. in: query name: org schema: type: string - description: | A DBRP mapping ID. Only returns the specified DBRP mapping. in: path name: dbrpID required: true schema: type: string responses: '204': description: Success. The delete is accepted. '400': content: application/json: examples: invalidRequest: description: | The query parameters contain invalid values. value: code: invalid message: invalid ID schema: $ref: '#/components/schemas/Error' description: Bad Request. Query parameters contain invalid values. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a database retention policy tags: - DBRPs get: description: > Retrieves the specified retention policy (DBRP) mapping. #### Related guide - [Database and retention policy mapping](https://docs.influxdata.com/influxdb/v2/reference/api/influxdb-1x/dbrp/) operationId: GetDBRPsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | An organization ID. Specifies the organization that owns the DBRP mapping. in: query name: orgID schema: type: string - description: | An organization name. Specifies the organization that owns the DBRP mapping. in: query name: org schema: type: string - description: | A DBRP mapping ID. Specifies the DBRP mapping. in: path name: dbrpID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: content: bucketID: 4d4d9d5b61dee751 database: example_database_1 default: true id: 0a3cbb5dd526a000 orgID: bea7ea952287f70d retention_policy: autogen schema: $ref: '#/components/schemas/DBRPGet' description: Success. The response body contains the DBRP mapping. '400': content: application/json: examples: invalidRequest: description: | The query parameters contain invalid values. value: code: invalid message: invalid ID schema: $ref: '#/components/schemas/Error' description: Bad Request. Query parameters contain invalid values. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a database retention policy mapping tags: - DBRPs patch: operationId: PatchDBRPID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | An organization ID. Specifies the organization that owns the DBRP mapping. in: query name: orgID schema: type: string - description: | An organization name. Specifies the organization that owns the DBRP mapping. in: query name: org schema: type: string - description: | A DBRP mapping ID. Specifies the DBRP mapping. in: path name: dbrpID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/DBRPUpdate' description: > Updates the database retention policy (DBRP) mapping and returns the mapping. Use this endpoint to modify the _retention policy_ (`retention_policy` property) of a DBRP mapping. #### Related guide - [Database and retention policy mapping](https://docs.influxdata.com/influxdb/v2/reference/api/influxdb-1x/dbrp/) required: true responses: '200': content: application/json: examples: successResponse: value: content: bucketID: 4d4d9d5b61dee751 database: example_database default: false id: 0a3cbb5dd526a000 orgID: bea7ea952287f70d retention_policy: example_retention_policy schema: $ref: '#/components/schemas/DBRPGet' description: An updated mapping '400': content: application/json: examples: invalidRequest: description: | The query parameters contain invalid values. value: code: invalid message: invalid ID schema: $ref: '#/components/schemas/Error' description: Bad Request. Query parameters contain invalid values. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a database retention policy mapping tags: - DBRPs x-codeSamples: - label: 'cURL: Update a DBRP mapping' lang: Shell source: | curl --request PATCH \ "http://localhost:8086/api/v2/dbrp/DBRP_ID" \ --header 'Content-type: application/json' \ --header "Authorization: Token INFLUX_API_TOKEN" \ --data-binary @- << EOF { "default": true, "retention_policy": "example_retention_policy_name" } EOF /debug/pprof/all: get: description: > Collects samples and returns reports for the following [Go runtime profiles](https://pkg.go.dev/runtime/pprof): - **allocs**: All past memory allocations - **block**: Stack traces that led to blocking on synchronization primitives - **cpu**: (Optional) Program counters sampled from the executing stack. Include by passing the `cpu` query parameter with a [duration](https://docs.influxdata.com/influxdb/v2/reference/glossary/#duration) value. Equivalent to the report from [`GET /debug/pprof/profile?seconds=NUMBER_OF_SECONDS`](#operation/GetDebugPprofProfile). - **goroutine**: All current goroutines - **heap**: Memory allocations for live objects - **mutex**: Holders of contended mutexes - **threadcreate**: Stack traces that led to the creation of new OS threads operationId: GetDebugPprofAllProfiles parameters: - $ref: '#/components/parameters/TraceSpan' - description: > Collects and returns CPU profiling data for the specified [duration](https://docs.influxdata.com/influxdb/v2/reference/glossary/#duration). in: query name: cpu schema: externalDocs: description: InfluxDB duration url: >- https://docs.influxdata.com/influxdb/v2/reference/glossary/#duration format: duration type: string responses: '200': content: application/octet-stream: schema: description: > Gzip compressed TAR file (`.tar.gz`) that contains [Go runtime profile](https://pkg.go.dev/runtime/pprof) reports. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string description: | [Go runtime profile](https://pkg.go.dev/runtime/pprof) reports. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve all runtime profiles tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: Get all profiles' lang: Shell source: > # Download and extract a `tar.gz` of all profiles after 10 seconds of CPU sampling. curl "http://localhost:8086/debug/pprof/all?cpu=10s" | tar -xz # x profiles/cpu.pb.gz # x profiles/goroutine.pb.gz # x profiles/block.pb.gz # x profiles/mutex.pb.gz # x profiles/heap.pb.gz # x profiles/allocs.pb.gz # x profiles/threadcreate.pb.gz # Analyze a profile. go tool pprof profiles/heap.pb.gz - label: 'Shell: Get all profiles except CPU' lang: Shell source: | # Download and extract a `tar.gz` of all profiles except CPU. curl http://localhost:8086/debug/pprof/all | tar -xz # x profiles/goroutine.pb.gz # x profiles/block.pb.gz # x profiles/mutex.pb.gz # x profiles/heap.pb.gz # x profiles/allocs.pb.gz # x profiles/threadcreate.pb.gz # Analyze a profile. go tool pprof profiles/heap.pb.gz /debug/pprof/allocs: get: description: > Returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of all past memory allocations. **allocs** is the same as the **heap** profile, but changes the default [pprof](https://pkg.go.dev/runtime/pprof) display to __-alloc_space__, the total number of bytes allocated since the program began (including garbage-collected bytes). operationId: GetDebugPprofAllocs parameters: - $ref: '#/components/parameters/TraceSpan' - description: > - `0`: (Default) Return the report as a gzip-compressed protocol buffer. - `1`: Return a response body with the report formatted as human-readable text. The report contains comments that translate addresses to function names and line numbers for debugging. `debug=1` is mutually exclusive with the `seconds` query parameter. in: query name: debug schema: enum: - 0 - 1 format: int64 type: integer - description: | Number of seconds to collect statistics. `seconds` is mutually exclusive with `debug=1`. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string text/plain: schema: description: | Response body contains a report formatted in plain text. The report contains comments that translate addresses to function names and line numbers for debugging. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: Go runtime profile type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. If debug is enabled (`?debug=1`), response body contains a human-readable profile. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the memory allocations runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: > # Analyze the profile in interactive mode. go tool pprof http://localhost:8086/debug/pprof/allocs # `pprof` returns the following prompt: # Entering interactive mode (type "help" for commands, "o" for options) # (pprof) # At the prompt, get the top N memory allocations. (pprof) top10 /debug/pprof/block: get: description: > Collects samples and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of stack traces that led to blocking on synchronization primitives. operationId: GetDebugPprofBlock parameters: - $ref: '#/components/parameters/TraceSpan' - description: > - `0`: (Default) Return the report as a gzip-compressed protocol buffer. - `1`: Return a response body with the report formatted as human-readable text. The report contains comments that translate addresses to function names and line numbers for debugging. `debug=1` is mutually exclusive with the `seconds` query parameter. in: query name: debug schema: enum: - 0 - 1 format: int64 type: integer - description: | Number of seconds to collect statistics. `seconds` is mutually exclusive with `debug=1`. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string text/plain: schema: description: | Response body contains a report formatted in plain text. The report contains comments that translate addresses to function names and line numbers for debugging. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: Go runtime profile type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. If debug is enabled (`?debug=1`), response body contains a human-readable profile. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the block runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: > # Analyze the profile in interactive mode. go tool pprof http://localhost:8086/debug/pprof/block # `pprof` returns the following prompt: # Entering interactive mode (type "help" for commands, "o" for options) # (pprof) # At the prompt, get the top N entries. (pprof) top10 /debug/pprof/cmdline: get: description: | Returns the command line that invoked InfluxDB. operationId: GetDebugPprofCmdline parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: text/plain: schema: format: Command line type: string description: Command line invocation. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the command line invocation tags: - Debug - System information endpoints /debug/pprof/goroutine: get: description: > Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of all current goroutines. operationId: GetDebugPprofGoroutine parameters: - $ref: '#/components/parameters/TraceSpan' - description: > - `0`: (Default) Return the report as a gzip-compressed protocol buffer. - `1`: Return a response body with the report formatted as human-readable text with comments that translate addresses to function names and line numbers for debugging. `debug=1` is mutually exclusive with the `seconds` query parameter. in: query name: debug schema: enum: - 0 - 1 format: int64 type: integer - description: | Number of seconds to collect statistics. `seconds` is mutually exclusive with `debug=1`. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string text/plain: schema: description: | Response body contains a report formatted in plain text. The report contains comments that translate addresses to function names and line numbers for debugging. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: Go runtime profile type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. If debug is enabled (`?debug=1`), response body contains a human-readable profile. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the goroutines runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: > # Analyze the profile in interactive mode. go tool pprof http://localhost:8086/debug/pprof/goroutine # `pprof` returns the following prompt: # Entering interactive mode (type "help" for commands, "o" for options) # (pprof) # At the prompt, get the top N entries. (pprof) top10 /debug/pprof/heap: get: description: > Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of memory allocations for live objects. To run **garbage collection** before sampling, pass the `gc` query parameter with a value of `1`. operationId: GetDebugPprofHeap parameters: - $ref: '#/components/parameters/TraceSpan' - description: > - `0`: (Default) Return the report as a gzip-compressed protocol buffer. - `1`: Return a response body with the report formatted as human-readable text. The report contains comments that translate addresses to function names and line numbers for debugging. `debug=1` is mutually exclusive with the `seconds` query parameter. in: query name: debug schema: enum: - 0 - 1 format: int64 type: integer - description: | Number of seconds to collect statistics. `seconds` is mutually exclusive with `debug=1`. in: query name: seconds schema: format: int64 type: string - description: | - `0`: (Default) don't force garbage collection before sampling. - `1`: Force garbage collection before sampling. in: query name: gc schema: enum: - 0 - 1 format: int64 type: integer responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string text/plain: examples: profileDebugResponse: summary: Profile in plain text value: "heap profile: 12431: 137356528 [149885081: 846795139976] @ heap/8192\n23: 17711104 [46: 35422208] @ 0x4c6df65 0x4ce03ec 0x4cdf3c5 0x4c6f4db 0x4c9edbc 0x4bdefb3 0x4bf822a 0x567d158 0x567ced9 0x406c0a1\n#\t0x4c6df64\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*entry).add+0x1a4\t\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/cache.go:97\n#\t0x4ce03eb\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*partition).write+0x2ab\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/ring.go:229\n#\t0x4cdf3c4\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*ring).write+0xa4\t\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/ring.go:95\n#\t0x4c6f4da\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*Cache).WriteMulti+0x31a\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/cache.go:343\n" schema: description: | Response body contains a report formatted in plain text. The report contains comments that translate addresses to function names and line numbers for debugging. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: Go runtime profile type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. If debug is enabled (`?debug=1`), response body contains a human-readable profile. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the heap runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: > # Analyze the profile in interactive mode. go tool pprof http://localhost:8086/debug/pprof/heap # `pprof` returns the following prompt: # Entering interactive mode (type "help" for commands, "o" for options) # (pprof) # At the prompt, get the top N memory-intensive nodes. (pprof) top10 # pprof displays the list: # Showing nodes accounting for 142.46MB, 85.43% of 166.75MB total # Dropped 895 nodes (cum <= 0.83MB) # Showing top 10 nodes out of 143 /debug/pprof/mutex: get: description: > Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of lock contentions. The profile contains stack traces of holders of contended mutual exclusions (mutexes). operationId: GetDebugPprofMutex parameters: - $ref: '#/components/parameters/TraceSpan' - description: > - `0`: (Default) Return the report as a gzip-compressed protocol buffer. - `1`: Return a response body with the report formatted as human-readable text. The report contains comments that translate addresses to function names and line numbers for debugging. `debug=1` is mutually exclusive with the `seconds` query parameter. in: query name: debug schema: enum: - 0 - 1 format: int64 type: integer - description: | Number of seconds to collect statistics. `seconds` is mutually exclusive with `debug=1`. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string text/plain: schema: description: | Response body contains a report formatted in plain text. The report contains comments that translate addresses to function names and line numbers for debugging. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: Go runtime profile type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. If debug is enabled (`?debug=1`), response body contains a human-readable profile. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the mutual exclusion (mutex) runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: > # Analyze the profile in interactive mode. go tool pprof http://localhost:8086/debug/pprof/mutex # `pprof` returns the following prompt: # Entering interactive mode (type "help" for commands, "o" for options) # (pprof) # At the prompt, get the top N entries. (pprof) top10 /debug/pprof/profile: get: description: > Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of program counters on the executing stack. operationId: GetDebugPprofProfile parameters: - $ref: '#/components/parameters/TraceSpan' - description: Number of seconds to collect profile data. Default is `30` seconds. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the CPU runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: | # Download the profile report. curl http://localhost:8086/debug/pprof/profile -o cpu # Analyze the profile in interactive mode. go tool pprof ./cpu # At the prompt, get the top N functions most often running # or waiting during the sample period. (pprof) top10 /debug/pprof/threadcreate: get: description: > Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of stack traces that led to the creation of new OS threads. operationId: GetDebugPprofThreadCreate parameters: - $ref: '#/components/parameters/TraceSpan' - description: > - `0`: (Default) Return the report as a gzip-compressed protocol buffer. - `1`: Return a response body with the report formatted as human-readable text. The report contains comments that translate addresses to function names and line numbers for debugging. `debug=1` is mutually exclusive with the `seconds` query parameter. in: query name: debug schema: enum: - 0 - 1 format: int64 type: integer - description: | Number of seconds to collect statistics. `seconds` is mutually exclusive with `debug=1`. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: binary type: string text/plain: examples: profileDebugResponse: summary: Profile in plain text value: "threadcreate profile: total 26\n25 @\n#\t0x0\n\n1 @ 0x403dda8 0x403e54b 0x403e810 0x403a90c 0x406c0a1\n#\t0x403dda7\truntime.allocm+0xc7\t\t\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:1877\n#\t0x403e54a\truntime.newm+0x2a\t\t\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:2201\n#\t0x403e80f\truntime.startTemplateThread+0x8f\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:2271\n#\t0x403a90b\truntime.main+0x1cb\t\t\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:234\n" schema: description: | Response body contains a report formatted in plain text. The report contains comments that translate addresses to function names and line numbers for debugging. externalDocs: description: Golang pprof package url: https://pkg.go.dev/net/http/pprof format: Go runtime profile type: string description: > [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible with [pprof](https://github.com/google/pprof) analysis and visualization tools. If debug is enabled (`?debug=1`), response body contains a human-readable profile. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the threadcreate runtime profile tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool pprof' lang: Shell source: > # Analyze the profile in interactive mode. go tool pprof http://localhost:8086/debug/pprof/threadcreate # `pprof` returns the following prompt: # Entering interactive mode (type "help" for commands, "o" for options) # (pprof) # At the prompt, get the top N entries. (pprof) top10 /debug/pprof/trace: get: description: > Collects profile data and returns trace execution events for the current program. operationId: GetDebugPprofTrace parameters: - $ref: '#/components/parameters/TraceSpan' - description: Number of seconds to collect profile data. in: query name: seconds schema: format: int64 type: string responses: '200': content: application/octet-stream: schema: externalDocs: description: Golang trace package url: https://pkg.go.dev/runtime/trace format: binary type: string description: | [Trace file](https://pkg.go.dev/runtime/trace) compatible with the [Golang `trace` command](https://pkg.go.dev/cmd/trace). default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the runtime execution trace tags: - Debug - System information endpoints x-codeSamples: - label: 'Shell: go tool trace' lang: Shell source: | # Download the trace file. curl http://localhost:8086/debug/pprof/trace -o trace # Analyze the trace. go tool trace ./trace /api/v2/delete: post: description: > Deletes data from a bucket. Use this endpoint to delete points from a bucket in a specified time range. #### InfluxDB Cloud - Does the following when you send a delete request: 1. Validates the request and queues the delete. 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise. 3. Handles the delete asynchronously and reaches eventual consistency. To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, wait for a success response (HTTP `2xx` status code) before you send the next request. Because writes and deletes are asynchronous, your change might not yet be readable when you receive the response. #### InfluxDB OSS v2 - Validates the request, handles the delete synchronously, and then responds with success or failure. #### Required permissions - `write-buckets` or `write-bucket BUCKET_ID`. *`BUCKET_ID`* is the ID of the destination bucket. #### Rate limits (with InfluxDB Cloud) `write` rate limits apply. For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). #### Related guides - [Delete data](https://docs.influxdata.com/influxdb/v2/write-data/delete-data/) - Learn how to use [delete predicate syntax](https://docs.influxdata.com/influxdb/v2/reference/syntax/delete-predicate/). - Learn how InfluxDB handles [deleted tags](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementtagkeys/) and [deleted fields](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementfieldkeys/). operationId: PostDelete parameters: - $ref: '#/components/parameters/TraceSpan' - description: | An organization name or ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Deletes data from the bucket in the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or the `orgID` parameter. - Deletes data from the bucket in the specified organization. - If you pass both `orgID` and `org`, they must both be valid. in: query name: org schema: description: The organization name or ID. type: string - description: > A bucket name or ID. Specifies the bucket to delete data from. If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. in: query name: bucket schema: description: The bucket name or ID. type: string - description: | An organization ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Deletes data from the bucket in the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or the `orgID` parameter. - Deletes data from the bucket in the specified organization. - If you pass both `orgID` and `org`, they must both be valid. in: query name: orgID schema: description: The organization ID. type: string - description: > A bucket ID. Specifies the bucket to delete data from. If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. in: query name: bucketID schema: description: The bucket ID. type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/DeletePredicateRequest' description: > Time range parameters and an optional **delete predicate expression**. To select points to delete within the specified time range, pass a **delete predicate expression** in the `predicate` property of the request body. If you don't pass a `predicate`, InfluxDB deletes all data with timestamps in the specified time range. #### Related guides - [Delete data](https://docs.influxdata.com/influxdb/v2/write-data/delete-data/) - Learn how to use [delete predicate syntax](https://docs.influxdata.com/influxdb/v2/reference/syntax/delete-predicate/). required: true responses: '204': description: > Success. #### InfluxDB Cloud - Validated and queued the request. - Handles the delete asynchronously - the deletion might not have completed yet. An HTTP `2xx` status code acknowledges that the write or delete is queued. To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, wait for a response before you send the next request. Because writes are asynchronous, data might not yet be written when you receive the response. #### InfluxDB OSS v2 - Deleted the data. '400': content: application/json: examples: orgNotFound: summary: Organization not found 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 v2 - Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Delete data tags: - Delete x-codeSamples: - label: cURL lang: Shell source: > curl --request POST INFLUX_URL/api/v2/delete?org=INFLUX_ORG&bucket=INFLUX_BUCKET \ --header 'Authorization: Token INFLUX_API_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "start": "2020-03-01T00:00:00Z", "stop": "2020-11-14T00:00:00Z", "predicate": "tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")" }' /api/v2/flags: get: description: > Retrieves the feature flag key-value pairs configured for the InfluxDB instance. _Feature flags_ are configuration options used to develop and test experimental InfluxDB features and are intended for internal use only. This endpoint represents the first step in the following three-step process to configure feature flags: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/v2/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. - Send a request to the [`GET /api/v2/config` endpoint](#operation/GetConfig) to retrieve the current runtime server configuration. #### Related guides - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/v2/reference/config-options/) operationId: GetFlags parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/Flags' description: Success. The response body contains feature flags. '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve feature flags tags: - Config /health: get: description: Returns the health of the instance. operationId: GetHealth parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/HealthCheck' description: | The instance is healthy. The response body contains the health check items and status. '503': content: application/json: schema: $ref: '#/components/schemas/HealthCheck' description: The instance is unhealthy. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve the health of the instance tags: - Health - System information endpoints /api/v2/labels: get: operationId: GetLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: query name: orgID schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: Success. The response body contains a list of labels. '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: List all labels tags: - Labels post: operationId: PostLabels requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelCreateRequest' description: The label to create. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: Success. The label was created. '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Create a label tags: - Labels /api/v2/labels/{labelID}: delete: operationId: DeleteLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the label to delete. in: path name: labelID required: true schema: type: string responses: '204': description: Success. The delete was accepted. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Delete a label tags: - Labels get: operationId: GetLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the label to update. in: path name: labelID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: Success. The response body contains the label. '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Retrieve a label tags: - Labels patch: operationId: PatchLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the label to update. in: path name: labelID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelUpdate' description: A label update. required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: Success. The response body contains the updated label. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Update a label tags: - Labels /api/v2/maps/mapToken: get: operationId: getMapboxToken responses: '200': content: application/json: schema: $ref: '#/components/schemas/Token' description: Temporary token for Mapbox. '401': $ref: '#/components/responses/ServerError' '500': $ref: '#/components/responses/ServerError' default: $ref: '#/components/responses/ServerError' summary: Get a mapbox token /api/v2/me: get: operationId: GetMe parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/UserResponse' description: >- Success. The response body contains the currently authenticated user. '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Retrieve the currently authenticated user tags: - Users /api/v2/me/password: put: description: > Updates the password for the signed-in [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). This endpoint represents the third step in the following three-step process to let a user with a user session update their password: 1. Pass the user's [Basic authentication credentials](#section/Authentication/BasicAuthentication) to the `POST /api/v2/signin` endpoint to create a user session and generate a session cookie. 2. From the response in the first step, extract the session cookie (`Set-Cookie`) header. 3. Pass the following in a request to the `PUT /api/v2/me/password` endpoint: - The `Set-Cookie` header from the second step - The `Authorization Basic` header with the user's _Basic authentication_ credentials - `{"password": "NEW_PASSWORD"}` in the request body #### InfluxDB Cloud - Doesn't let you manage user passwords through the API. Use the InfluxDB Cloud user interface (UI) to update your password. #### Related endpoints - [Signin](#tag/Signin) - [Signout](#tag/Signout) - [Users](#tag/Users) #### Related guides - [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) - [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/v2/users/change-password/) operationId: PutMePassword parameters: - $ref: '#/components/parameters/TraceSpan' - description: > The user session cookie for the [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) signed in with [Basic authentication credentials](#section/Authentication/BasicAuthentication). #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) example: >- influxdb-oss-session=19aaaZZZGOvP2GGryXVT2qYftlFKu3bIopurM6AGFow1yF1abhtOlbHfsc-d8gozZFC_6WxmlQIAwLMW5xs523w== in: cookie name: influxdb-oss-session required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/PasswordResetBody' description: The new password. required: true responses: '204': description: Success. The password is updated. '400': description: > Bad request. #### InfluxDB Cloud - Doesn't let you manage user passwords through the API; always responds with this status. #### InfluxDB OSS v2 - Doesn't understand a value passed in the request. '401': $ref: '#/components/responses/AuthorizationError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unsuccessful authentication security: - BasicAuthentication: [] summary: Update a password tags: - Users /metrics: get: description: > Returns metrics about the workload performance of an InfluxDB instance. Use this endpoint to get performance, resource, and usage metrics. #### Related guides - For the list of metrics categories, see [InfluxDB OSS metrics](https://docs.influxdata.com/influxdb/v2/reference/internals/metrics/). - Learn how to use InfluxDB to [scrape Prometheus metrics](https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/scrape-prometheus-metrics/). - Learn how InfluxDB [parses the Prometheus exposition format](https://docs.influxdata.com/influxdb/v2/reference/prometheus-metrics/). operationId: GetMetrics parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: text/plain: examples: expositionResponse: summary: Metrics in plain text value: > # HELP go_threads Number of OS threads created. # TYPE go_threads gauge go_threads 19 # HELP http_api_request_duration_seconds Time taken to respond to HTTP request # TYPE http_api_request_duration_seconds histogram http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.005"} 4 http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.01"} 4 http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.025"} 5 schema: externalDocs: description: Prometheus exposition formats url: https://prometheus.io/docs/instrumenting/exposition_formats format: Prometheus text-based exposition type: string description: > Success. The response body contains metrics in [Prometheus plain-text exposition format](https://prometheus.io/docs/instrumenting/exposition_formats) Metrics contain a name, an optional set of key-value pairs, and a value. The following descriptors precede each metric: - `HELP`: description of the metric - `TYPE`: [Prometheus metric type](https://prometheus.io/docs/concepts/metric_types/) (`counter`, `gauge`, `histogram`, or `summary`) default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Retrieve workload performance metrics tags: - Metrics - System information endpoints /api/v2/notificationEndpoints: get: operationId: GetNotificationEndpoints parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - description: >- Only show notification endpoints that belong to specific organization ID. in: query name: orgID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationEndpoints' description: A list of notification endpoints default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all notification endpoints tags: - NotificationEndpoints post: operationId: CreateNotificationEndpoint requestBody: content: application/json: schema: $ref: '#/components/schemas/PostNotificationEndpoint' description: Notification endpoint to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/NotificationEndpoint' description: Notification endpoint created default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a notification endpoint tags: - NotificationEndpoints /api/v2/notificationEndpoints/{endpointID}: delete: operationId: DeleteNotificationEndpointsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The endpoint was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a notification endpoint tags: - NotificationEndpoints get: operationId: GetNotificationEndpointsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationEndpoint' description: The notification endpoint requested default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a notification endpoint tags: - NotificationEndpoints patch: operationId: PatchNotificationEndpointsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/NotificationEndpointUpdate' description: Check update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationEndpoint' description: An updated notification endpoint '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The notification endpoint was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a notification endpoint tags: - NotificationEndpoints put: operationId: PutNotificationEndpointsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/NotificationEndpoint' description: A new notification endpoint to replace the existing endpoint with required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationEndpoint' description: An updated notification endpoint '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The notification endpoint was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a notification endpoint tags: - NotificationEndpoints /api/v2/notificationEndpoints/{endpointID}/labels: get: operationId: GetNotificationEndpointsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of all labels for a notification endpoint default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a notification endpoint tags: - NotificationEndpoints post: operationId: PostNotificationEndpointIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The label was added to the notification endpoint default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a notification endpoint tags: - NotificationEndpoints /api/v2/notificationEndpoints/{endpointID}/labels/{labelID}: delete: operationId: DeleteNotificationEndpointsIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification endpoint ID. in: path name: endpointID 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: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Endpoint or label not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a label from a notification endpoint tags: - NotificationEndpoints /api/v2/notificationRules: get: operationId: GetNotificationRules parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - description: >- Only show notification rules that belong to a specific organization ID. in: query name: orgID required: true schema: type: string - description: Only show notifications that belong to the specific check ID. in: query name: checkID schema: type: string - description: >- Only return notification rules that "would match" statuses which contain the tag key value pairs provided. in: query name: tag schema: example: env:prod pattern: ^[a-zA-Z0-9_]+:[a-zA-Z0-9_]+$ type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationRules' description: A list of notification rules default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all notification rules tags: - NotificationRules post: operationId: CreateNotificationRule requestBody: content: application/json: schema: $ref: '#/components/schemas/PostNotificationRule' description: Notification rule to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/NotificationRule' description: Notification rule created default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a notification rule tags: - NotificationRules /api/v2/notificationRules/{ruleID}: delete: operationId: DeleteNotificationRulesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The check was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a notification rule tags: - NotificationRules get: operationId: GetNotificationRulesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationRule' description: The notification rule requested default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a notification rule tags: - NotificationRules patch: operationId: PatchNotificationRulesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/NotificationRuleUpdate' description: Notification rule update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationRule' description: An updated notification rule '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The notification rule was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a notification rule tags: - NotificationRules put: operationId: PutNotificationRulesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/NotificationRule' description: Notification rule update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/NotificationRule' description: An updated notification rule '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: The notification rule was not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a notification rule tags: - NotificationRules /api/v2/notificationRules/{ruleID}/labels: get: operationId: GetNotificationRulesIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of all labels for a notification rule default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a notification rule tags: - NotificationRules post: operationId: PostNotificationRuleIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The label was added to the notification rule default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a notification rule tags: - NotificationRules /api/v2/notificationRules/{ruleID}/labels/{labelID}: delete: operationId: DeleteNotificationRulesIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID 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: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Rule or label not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete label from a notification rule tags: - NotificationRules /api/v2/notificationRules/{ruleID}/query: get: operationId: GetNotificationRulesIDQuery parameters: - $ref: '#/components/parameters/TraceSpan' - description: The notification rule ID. in: path name: ruleID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/FluxResponse' description: The notification rule query requested '400': content: application/json: schema: $ref: '#/components/schemas/Error' description: Invalid request '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Notification rule not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a notification rule query tags: - Rules /api/v2/orgs: get: description: > Lists [organizations](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization/). To limit which organizations are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all organizations up to the default `limit`. #### InfluxDB Cloud - Only returns the organization that owns the token passed in the request. #### Related guides - [View organizations](https://docs.influxdata.com/influxdb/v2/organizations/view-orgs/) operationId: GetOrgs parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Descending' - description: | An organization name. Only returns the specified organization. in: query name: org schema: type: string - description: | An organization ID. Only returns the specified organization. in: query name: orgID schema: type: string - description: > A user ID. Only returns organizations where the specified user is a member or owner. in: query name: userID schema: type: string responses: '200': content: application/json: examples: successResponse: value: links: self: /api/v2/orgs orgs: - createdAt: '2022-07-17T23:00:30.778487Z' description: Example InfluxDB organization id: INFLUX_ORG_ID links: buckets: /api/v2/buckets?org=INFLUX_ORG dashboards: /api/v2/dashboards?org=INFLUX_ORG labels: /api/v2/orgs/INFLUX_ORG_ID/labels logs: /api/v2/orgs/INFLUX_ORG_ID/logs members: /api/v2/orgs/INFLUX_ORG_ID/members owners: /api/v2/orgs/INFLUX_ORG_ID/owners secrets: /api/v2/orgs/INFLUX_ORG_ID/secrets self: /api/v2/orgs/INFLUX_ORG_ID tasks: /api/v2/tasks?org=InfluxData name: INFLUX_ORG updatedAt: '2022-07-17T23:00:30.778487Z' schema: $ref: '#/components/schemas/Organizations' description: Success. The response body contains a list of organizations. '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 organizations tags: - Organizations - Security and access endpoints post: description: > Creates an [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization) and returns the newly created organization. #### InfluxDB Cloud - Doesn't allow you to use this endpoint to create organizations. #### Related guides - [Manage organizations](https://docs.influxdata.com/influxdb/v2/organizations) operationId: PostOrgs parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostOrganizationRequest' description: The organization to create. required: true responses: '201': content: application/json: examples: successResponse: value: createdAt: '2022-08-24T23:05:52.881317Z' description: '' id: INFLUX_ORG_ID links: buckets: /api/v2/buckets?org=INFLUX_ORG dashboards: /api/v2/dashboards?org=INFLUX_ORG labels: /api/v2/orgs/INFLUX_ORG_ID/labels logs: /api/v2/orgs/INFLUX_ORG_ID/logs members: /api/v2/orgs/INFLUX_ORG_ID/members owners: /api/v2/orgs/INFLUX_ORG_ID/owners secrets: /api/v2/orgs/INFLUX_ORG_ID/secrets self: /api/v2/orgs/INFLUX_ORG_ID tasks: /api/v2/tasks?org=INFLUX_ORG name: INFLUX_ORG updatedAt: '2022-08-24T23:05:52.881318Z' schema: $ref: '#/components/schemas/Organization' description: Created. The response body contains the organization information. '400': $ref: '#/components/responses/BadRequestError' examples: invalidRequest: summary: The `name` field is missing from the request body. value: code: invalid message: org name is empty '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Create an organization tags: - Organizations x-codeSamples: - label: cURL lang: Shell source: | curl --request POST "http://localhost:8086/api/v2/orgs \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "name": "INFLUX_ORG", "description: "Example InfluxDB organization" }' /api/v2/orgs/{orgID}: delete: description: > Deletes an organization. Deleting an organization from InfluxDB Cloud can't be undone. Once deleted, all data associated with the organization is removed. #### InfluxDB Cloud - Does the following when you send a delete request: 1. Validates the request and queues the delete. 2. Returns an HTTP `204` status code if queued; _error_ otherwise. 3. Handles the delete asynchronously. #### InfluxDB OSS v2 - Validates the request, handles the delete synchronously, and then responds with success or failure. #### Limitations - Only one organization can be deleted per request. #### Related guides - [Delete organizations](https://docs.influxdata.com/influxdb/v2/organizations/delete-orgs/) operationId: DeleteOrgsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the organization to delete. in: path name: orgID required: true schema: type: string responses: '204': description: | Success. #### InfluxDB Cloud - The organization is queued for deletion. #### InfluxDB OSS v2 - The organization is deleted. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested organization was not found. value: code: not found message: org not found schema: $ref: '#/components/schemas/Error' description: | Not found. InfluxDB can't find the organization. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete an organization tags: - Organizations get: description: > Retrieves an organization. Use this endpoint to retrieve information for a specific organization. #### Related guides - [View organizations](https://docs.influxdata.com/influxdb/v2/organizations/view-orgs/) operationId: GetOrgsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the organization to retrieve. in: path name: orgID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Organization' description: | Success. The response body contains the organization information. '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested organization wasn't found. value: code: not found message: organization not found schema: $ref: '#/components/schemas/Error' description: | Not found. Organization not found. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve an organization tags: - Organizations - Security and access endpoints patch: description: > Updates an organization. Use this endpoint to update properties (`name`, `description`) of an organization. Updating an organization’s name affects all resources that reference the organization by name, including the following: - Queries - Dashboards - Tasks - Telegraf configurations - Templates If you change an organization name, be sure to update the organization name in these resources as well. #### Related Guides - [Update an organization](https://docs.influxdata.com/influxdb/v2/organizations/update-org/) operationId: PatchOrgsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the organization to update. in: path name: orgID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/PatchOrganizationRequest' description: The organization update to apply. required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Organization' description: Success. The response body contains the updated organization. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update an organization tags: - Organizations /api/v2/orgs/{orgID}/members: get: description: > Lists all users that belong to an organization. InfluxDB [users](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) have permission to access InfluxDB. [Members](https://docs.influxdata.com/influxdb/v2/reference/glossary/#member) are users within the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Member permissions are separate from API token permissions. - Member permissions are used in the context of the InfluxDB UI. #### Required permissions - `read-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve members for. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) - [Manage members](https://docs.influxdata.com/influxdb/v2/organizations/members/) operationId: GetOrgsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the organization to retrieve users for. in: path name: orgID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: links: self: /api/v2/orgs/055aa4783aa38398/members users: - id: 791df274afd48a83 links: self: /api/v2/users/791df274afd48a83 name: example_user_1 role: member status: active - id: 09cfb87051cbe000 links: self: /api/v2/users/09cfb87051cbe000 name: example_user_2 role: owner status: active schema: $ref: '#/components/schemas/ResourceMembers' description: > Success. The response body contains a list of all users within the organization. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': content: application/json: examples: notFound: summary: | The requested organization wasn't found. value: code: not found message: 404 page not found schema: $ref: '#/components/schemas/Error' description: | Not found. InfluxDB can't find the organization. '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all members of an organization tags: - Organizations - Security and access endpoints post: description: > Add a user to an organization. InfluxDB [users](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) have permission to access InfluxDB. [Members](https://docs.influxdata.com/influxdb/v2/reference/glossary/#member) are users within the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Member permissions are separate from API token permissions. - Member permissions are used in the context of the InfluxDB UI. #### Required permissions - `write-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/users/) - [Manage members](https://docs.influxdata.com/influxdb/v2/organizations/members/) operationId: PostOrgsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the organization. in: path name: orgID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: | The user to add to the organization. required: true responses: '201': content: application/json: examples: successResponse: value: id: 09cfb87051cbe000 links: self: /api/v2/users/09cfb87051cbe000 name: example_user_1 role: member status: active schema: $ref: '#/components/schemas/ResourceMember' description: | Success. The response body contains the user information. '400': $ref: '#/components/responses/BadRequestError' examples: invalidRequest: summary: The user `id` is missing from the request body. value: code: invalid message: user id missing or invalid '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a member to an organization tags: - Organizations x-codeSamples: - label: cURL lang: Shell source: > curl --request POST "http://localhost:8086/api/v2/orgs/INFLUX_ORG_ID/members \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "id": "09cfb87051cbe000" }' /api/v2/orgs/{orgID}/members/{userID}: delete: description: > Removes a member from an organization. Use this endpoint to remove a user's member privileges for an organization. Removing member privileges removes the user's `read` and `write` permissions from the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Member permissions are separate from API token permissions. - Member permissions are used in the context of the InfluxDB UI. #### Required permissions - `write-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner from. #### Related guides - [Manage members](https://docs.influxdata.com/influxdb/v2/organizations/members/) operationId: DeleteOrgsIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the user to remove. in: path name: userID required: true schema: type: string - description: The ID of the organization to remove a user from. in: path name: orgID required: true schema: type: string responses: '204': description: | Success. The user is no longer a member of the organization. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Remove a member from an organization tags: - Organizations - Security and access endpoints /api/v2/orgs/{orgID}/owners: get: description: > Lists all owners of an organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Required permissions - `read-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a list of owners from. operationId: GetOrgsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The ID of the organization to list owners for. in: path name: orgID required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: links: self: /api/v2/orgs/055aa4783aa38398/owners users: - id: 09cfb87051cbe000 links: self: /api/v2/users/09cfb87051cbe000 name: example_user_2 role: owner status: active schema: $ref: '#/components/schemas/ResourceOwners' description: A list of organization owners '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Organization not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all owners of an organization tags: - Organizations - Security and access endpoints post: description: > Adds an owner to an organization. Use this endpoint to assign the organization `owner` role to a user. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Required permissions - `write-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for. #### Related endpoints - [Authorizations](#tag/Authorizations-(API-tokens)) operationId: PostOrgsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the organization that you want to add an owner for. in: path name: orgID required: true schema: type: string requestBody: content: application/json: examples: successResponse: value: id: 09cfb87051cbe000 links: self: /api/v2/users/09cfb87051cbe000 name: example_user_1 role: owner status: active schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: The user to add as an owner of the organization. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' description: | Success. The user is an owner of the organization. The response body contains the owner with role and user detail. '400': $ref: '#/components/responses/BadRequestError' '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add an owner to an organization tags: - Organizations x-codeSamples: - label: cURL lang: Shell source: > curl --request POST "http://localhost:8086/api/v2/orgs/INFLUX_ORG_ID/owners \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{ "id": "09cfb87051cbe000" }' /api/v2/orgs/{orgID}/owners/{userID}: delete: description: > Removes an [owner](https://docs.influxdata.com/influxdb/v2/reference/glossary/#owner) from the organization. Organization owners have permission to delete organizations and remove user and member permissions from the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations - Owner permissions are separate from API token permissions. - Owner permissions are used in the context of the InfluxDB UI. #### Required permissions - `write-orgs INFLUX_ORG_ID` *`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner from. #### Related endpoints - [Authorizations](#tag/Authorizations-(API-tokens)) operationId: DeleteOrgsIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the user to remove. in: path name: userID required: true schema: type: string - description: | The ID of the organization to remove an owner from. in: path name: orgID required: true schema: type: string responses: '204': description: | Success. The user is no longer an owner of the organization. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Remove an owner from an organization tags: - Organizations - Security and access endpoints /api/v2/orgs/{orgID}/secrets: get: operationId: GetOrgsIDSecrets parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: path name: orgID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/SecretKeysResponse' description: A list of all secret keys default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all secret keys for an organization tags: - Secrets - Security and access endpoints patch: operationId: PatchOrgsIDSecrets parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: path name: orgID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Secrets' description: Secret key value pairs to update/add required: true responses: '204': description: Keys successfully patched default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update secrets in an organization tags: - Secrets /api/v2/orgs/{orgID}/secrets/{secretID}: delete: operationId: DeleteOrgsIDSecretsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: path name: orgID required: true schema: type: string - description: The secret ID. in: path name: secretID required: true schema: type: string responses: '204': description: Keys successfully deleted default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Delete a secret from an organization tags: - Secrets - Security and access endpoints /api/v2/orgs/{orgID}/secrets/delete: post: deprecated: true operationId: PostOrgsIDSecrets parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: path name: orgID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/SecretKeys' description: Secret key to delete required: true responses: '204': description: Keys successfully patched default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete secrets from an organization tags: - Secrets - Security and access endpoints /ping: get: description: > Retrieves the status and InfluxDB version of the instance. Use this endpoint to monitor uptime for the InfluxDB instance. The response returns a HTTP `204` status code to inform you the instance is available. #### InfluxDB Cloud - Isn't versioned and doesn't return `X-Influxdb-Version` in the headers. #### Related guides - [Influx ping](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/ping/) operationId: GetPing responses: '204': description: | Success. Headers contain InfluxDB version information. headers: X-Influxdb-Build: description: | The type of InfluxDB build. schema: type: string X-Influxdb-Version: description: | The version of InfluxDB. #### InfluxDB Cloud - Doesn't return version. schema: type: integer servers: [] summary: Get the status of the instance tags: - Ping - System information endpoints x-codeSamples: - label: cURL lang: Shell source: | curl --request GET "http://localhost:8086/ping" head: description: > Returns the status and InfluxDB version of the instance. Use this endpoint to monitor uptime for the InfluxDB instance. The response returns a HTTP `204` status code to inform you the instance is available. #### InfluxDB Cloud - Isn't versioned and doesn't return `X-Influxdb-Version` in the headers. #### Related guides - [Influx ping](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/ping/) operationId: HeadPing responses: '204': description: | Success. Headers contain InfluxDB version information. headers: X-Influxdb-Build: description: The type of InfluxDB build. schema: type: string X-Influxdb-Version: description: | The version of InfluxDB. #### InfluxDB Cloud - Doesn't return version. schema: type: integer servers: [] summary: Get the status of the instance tags: - Ping x-codeSamples: - label: cURL lang: Shell source: | curl --request HEAD "http://localhost:8086/ping" /api/v2/query: post: description: > Retrieves data from buckets. Use this endpoint to send a Flux query request and retrieve data from a bucket. #### Rate limits (with InfluxDB Cloud) `read` rate limits apply. For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). #### Related guides - [Query with the InfluxDB API](https://docs.influxdata.com/influxdb/v2/query-data/execute-queries/influx-api/) - [Get started with Flux](https://docs.influxdata.com/flux/v0.x/get-started/) operationId: PostQuery parameters: - $ref: '#/components/parameters/TraceSpan' - description: >- The content encoding (usually a compression algorithm) that the client can understand. in: header name: Accept-Encoding schema: default: identity description: >- The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string - in: header name: Content-Type schema: enum: - application/json - application/vnd.flux type: string - description: > An organization name or ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Queries the bucket in the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or `orgID` parameter. - Queries the bucket in the specified organization. in: query name: org schema: type: string - description: > An organization ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Queries the bucket in the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or `orgID` parameter. - Queries the bucket in the specified organization. in: query name: orgID schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Query' application/vnd.flux: example: | from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement") schema: type: string description: Flux query or specification to execute responses: '200': content: application/csv: example: > result,table,_start,_stop,_time,region,host,_value mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62 schema: type: string description: Success. The response body contains query results. headers: Content-Encoding: description: >- Lists encodings (usually compression algorithms) that have been applied to the response payload. schema: default: identity description: > The content coding: `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string Trace-Id: description: The trace ID, if generated, of the request. schema: description: Trace ID of a request. type: string '400': content: application/json: examples: orgNotFound: summary: Organization not found 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 v2 - Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '429': description: | #### InfluxDB Cloud: - returns this error if a **read** or **write** request exceeds your plan's [adjustable service quotas](https://docs.influxdata.com/influxdb/v2/account-management/limits/#adjustable-service-quotas) or if a **delete** request exceeds the maximum [global limit](https://docs.influxdata.com/influxdb/v2/account-management/limits/#global-limits) - returns `Retry-After` header that describes when to try the write again. #### InfluxDB OSS v2: - doesn't return this error. headers: Retry-After: description: >- Non-negative decimal integer indicating seconds to wait before retrying the request. schema: format: int32 type: integer '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Query data tags: - Query data x-codeSamples: - label: cURL lang: Shell source: | curl --request POST 'INFLUX_URL/api/v2/query?org=INFLUX_ORG' \ --header 'Content-Type: application/vnd.flux' \ --header 'Accept: application/csv \ --header 'Authorization: Token INFLUX_API_TOKEN' \ --data 'from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement")' /api/v2/query/analyze: post: description: > Analyzes a [Flux query](https://docs.influxdata.com/flux/v0.x/) for syntax errors and returns the list of errors. In the following sample query, `from()` is missing the property key. ```json { "query": "from(: \"iot_center\")\ |> range(start: -90d)\ |> filter(fn: (r) => r._measurement == \"environment\")", "type": "flux" } ``` If you pass this in a request to the `/api/v2/analyze` endpoint, InfluxDB returns an `errors` list that contains an error object for the missing key. #### Limitations - The endpoint doesn't validate values in the query--for example: - The following sample query has correct syntax, but contains an incorrect `from()` property key: ```json { "query": "from(foo: \"iot_center\")\ |> range(start: -90d)\ |> filter(fn: (r) => r._measurement == \"environment\")", "type": "flux" } ``` If you pass this in a request to the `/api/v2/analyze` endpoint, InfluxDB returns an empty `errors` list. operationId: PostQueryAnalyze parameters: - $ref: '#/components/parameters/TraceSpan' - in: header name: Content-Type schema: enum: - application/json type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Query' description: Flux query to analyze responses: '200': content: application/json: examples: missingQueryPropertyKey: description: > Returns an error object if the Flux query is missing a property key. The following sample query is missing the _`bucket`_ property key: ```json { "query": "from(: \"iot_center\")\ ... } ``` summary: Missing property key error value: errors: - character: 0 column: 6 line: 1 message: missing property key schema: $ref: '#/components/schemas/AnalyzeQueryResponse' description: > Success. The response body contains the list of `errors`. If the query syntax is valid, the endpoint returns an empty `errors` list. '400': content: application/json: examples: invalidJSONStringValue: description: >- If the request body contains invalid JSON, returns `invalid` and problem detail. summary: Invalid JSON value: code: invalid message: >- invalid json: invalid character '\'' looking for beginning of value schema: $ref: '#/components/schemas/Error' description: | Bad request. InfluxDB is unable to parse the request. The response body contains detail about the problem. headers: X-Platform-Error-Code: description: | The reason for the error. schema: example: invalid type: string default: content: application/json: examples: emptyJSONObject: description: > If the request body contains an empty JSON object, returns `internal error`. summary: Empty JSON object in request body value: code: internal error message: An internal error has occurred - check server logs schema: $ref: '#/components/schemas/Error' description: Internal server error headers: X-Influx-Error: description: A string that describes the problem. schema: type: string X-Influx-Reference: description: The numeric reference code for the error type. schema: type: integer X-Platform-Error-Code: description: The reason for the error. schema: example: internal error type: string summary: Analyze a Flux query tags: - Query data x-codeSamples: - label: 'cURL: Analyze a Flux query' lang: Shell source: | curl -v --request POST \ "http://localhost:8086/api/v2/query/analyze" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header 'Content-type: application/json' \ --header 'Accept: application/json' \ --data-binary @- << EOF { "query": "from(bucket: \"iot_center\")\ |> range(start: -90d)\ |> filter(fn: (r) => r._measurement == \"environment\")", "type": "flux" } EOF /api/v2/query/ast: post: description: > Analyzes a Flux query and returns a complete package source [Abstract Syntax Tree (AST)](https://docs.influxdata.com/influxdb/v2/reference/glossary/#abstract-syntax-tree-ast) for the query. Use this endpoint for deep query analysis such as debugging unexpected query results. A Flux query AST provides a semantic, tree-like representation with contextual information about the query. The AST illustrates how the query is distributed into different components for execution. #### Limitations - The endpoint doesn't validate values in the query--for example: The following sample Flux query has correct syntax, but contains an incorrect `from()` property key: ```js from(foo: "iot_center") |> range(start: -90d) |> filter(fn: (r) => r._measurement == "environment") ``` The following sample JSON shows how to pass the query in the request body: ```js from(foo: "iot_center") |> range(start: -90d) |> filter(fn: (r) => r._measurement == "environment") ``` The following code sample shows how to pass the query as JSON in the request body: ```json { "query": "from(foo: \"iot_center\")\ |> range(start: -90d)\ |> filter(fn: (r) => r._measurement == \"environment\")" } ``` Passing this to `/api/v2/query/ast` will return a successful response with a generated AST. operationId: PostQueryAst parameters: - $ref: '#/components/parameters/TraceSpan' - in: header name: Content-Type schema: enum: - application/json type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LanguageRequest' description: The Flux query to analyze. responses: '200': content: application/json: examples: successResponse: value: ast: files: - body: - expression: argument: argument: arguments: - location: end: column: 25 line: 1 source: 'bucket: "example-bucket"' start: column: 6 line: 1 properties: - key: location: end: column: 12 line: 1 source: bucket start: column: 6 line: 1 name: bucket type: Identifier location: end: column: 25 line: 1 source: 'bucket: "example-bucket"' start: column: 6 line: 1 type: Property value: location: end: column: 25 line: 1 source: '"example-bucket"' start: column: 14 line: 1 type: StringLiteral value: example-bucket type: ObjectExpression callee: location: end: column: 5 line: 1 source: from start: column: 1 line: 1 name: from type: Identifier location: end: column: 26 line: 1 source: 'from(bucket: "example-bucket")' start: column: 1 line: 1 type: CallExpression call: arguments: - location: end: column: 46 line: 1 source: 'start: -5m' start: column: 36 line: 1 properties: - key: location: end: column: 41 line: 1 source: start start: column: 36 line: 1 name: start type: Identifier location: end: column: 46 line: 1 source: 'start: -5m' start: column: 36 line: 1 type: Property value: argument: location: end: column: 46 line: 1 source: 5m start: column: 44 line: 1 type: DurationLiteral values: - magnitude: 5 unit: m location: end: column: 46 line: 1 source: '-5m' start: column: 43 line: 1 operator: '-' type: UnaryExpression type: ObjectExpression callee: location: end: column: 35 line: 1 source: range start: column: 30 line: 1 name: range type: Identifier location: end: column: 47 line: 1 source: 'range(start: -5m)' start: column: 30 line: 1 type: CallExpression location: end: column: 47 line: 1 source: >- from(bucket: "example-bucket") |> range(start: -5m) start: column: 1 line: 1 type: PipeExpression call: arguments: - location: end: column: 108 line: 1 source: >- fn: (r) => r._measurement == "example-measurement" start: column: 58 line: 1 properties: - key: location: end: column: 60 line: 1 source: fn start: column: 58 line: 1 name: fn type: Identifier location: end: column: 108 line: 1 source: >- fn: (r) => r._measurement == "example-measurement" start: column: 58 line: 1 type: Property value: body: left: location: end: column: 83 line: 1 source: r._measurement start: column: 69 line: 1 object: location: end: column: 70 line: 1 source: r start: column: 69 line: 1 name: r type: Identifier property: location: end: column: 83 line: 1 source: _measurement start: column: 71 line: 1 name: _measurement type: Identifier type: MemberExpression location: end: column: 108 line: 1 source: r._measurement == "example-measurement" start: column: 69 line: 1 operator: '==' right: location: end: column: 108 line: 1 source: '"example-measurement"' start: column: 87 line: 1 type: StringLiteral value: example-measurement type: BinaryExpression location: end: column: 108 line: 1 source: >- (r) => r._measurement == "example-measurement" start: column: 62 line: 1 params: - key: location: end: column: 64 line: 1 source: r start: column: 63 line: 1 name: r type: Identifier location: end: column: 64 line: 1 source: r start: column: 63 line: 1 type: Property value: null type: FunctionExpression type: ObjectExpression callee: location: end: column: 57 line: 1 source: filter start: column: 51 line: 1 name: filter type: Identifier location: end: column: 109 line: 1 source: >- filter(fn: (r) => r._measurement == "example-measurement") start: column: 51 line: 1 type: CallExpression location: end: column: 109 line: 1 source: >- from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement") start: column: 1 line: 1 type: PipeExpression location: end: column: 109 line: 1 source: >- from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement") start: column: 1 line: 1 type: ExpressionStatement imports: null location: end: column: 109 line: 1 source: >- from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement") start: column: 1 line: 1 metadata: parser-type=rust package: null type: File package: main type: Package schema: $ref: '#/components/schemas/ASTResponse' description: > Success. The response body contains an Abstract Syntax Tree (AST) of the Flux query. '400': content: application/json: examples: invalidASTValue: description: > If the request body contains a missing property key in `from()`, returns `invalid` and problem detail. summary: Invalid AST value: code: invalid message: 'invalid AST: loc 1:6-1:19: missing property key' schema: $ref: '#/components/schemas/Error' description: | Bad request. InfluxDB is unable to parse the request. The response body contains detail about the problem. headers: X-Platform-Error-Code: description: | The reason for the error. schema: example: invalid type: string default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error. summary: Generate a query Abstract Syntax Tree (AST) tags: - Query data x-codeSamples: - label: 'cURL: Analyze and generate AST for the query' lang: Shell source: | curl --request POST "http://localhost:8086/api/v2/query/ast" \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header "Authorization: Token INFLUX_TOKEN" \ --data-binary @- << EOL { "query": "from(bucket: \"INFLUX_BUCKET_NAME\")\ |> range(start: -5m)\ |> filter(fn: (r) => r._measurement == \"example-measurement\")" } EOL /api/v2/query/suggestions: get: description: > Lists Flux query suggestions. Each suggestion contains a [Flux function](https://docs.influxdata.com/flux/v0.x/stdlib/all-functions/) name and parameters. Use this endpoint to retrieve a list of Flux query suggestions used in the InfluxDB Flux Query Builder. #### Limitations - When writing a query, avoid using `_functionName()` helper functions exposed by this endpoint. Helper function names have an underscore (`_`) prefix and aren't meant to be used directly in queries--for example: - To sort on a column and keep the top n records, use the `top(n, columns=["_value"], tables=<-)` function instead of the `_sortLimit` helper function. `top` uses `_sortLimit`. #### Related Guides - [List of all Flux functions](https://docs.influxdata.com/flux/v0.x/stdlib/all-functions/) operationId: GetQuerySuggestions parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: examples: successResponse: value: funcs: - name: _fillEmpty params: createEmpty: bool tables: stream - name: _highestOrLowest params: _sortLimit: function column: invalid groupColumns: array 'n': invalid reducer: function tables: stream - name: _hourSelection params: location: object start: int stop: int tables: stream timeColumn: string - name: _sortLimit params: columns: array desc: bool 'n': int tables: stream - name: _window params: createEmpty: bool every: duration location: object offset: duration period: duration startColumn: string stopColumn: string tables: stream timeColumn: string - name: aggregateWindow params: column: invalid createEmpty: bool every: duration fn: function location: object offset: duration period: duration tables: stream timeDst: string timeSrc: string - name: bool params: v: invalid - name: bottom params: columns: array 'n': int tables: stream - name: buckets params: host: string org: string orgID: string token: string - name: bytes params: v: invalid - name: cardinality params: bucket: string bucketID: string host: string org: string orgID: string predicate: function start: invalid stop: invalid token: string - name: chandeMomentumOscillator params: columns: array 'n': int tables: stream - name: columns params: column: string tables: stream - name: contains params: set: array value: invalid - name: count params: column: string tables: stream - name: cov params: 'on': array pearsonr: bool x: invalid 'y': invalid - name: covariance params: columns: array pearsonr: bool tables: stream valueDst: string - name: cumulativeSum params: columns: array tables: stream - name: derivative params: columns: array initialZero: bool nonNegative: bool tables: stream timeColumn: string unit: duration - name: die params: msg: string - name: difference params: columns: array initialZero: bool keepFirst: bool nonNegative: bool tables: stream - name: display params: v: invalid - name: distinct params: column: string tables: stream - name: doubleEMA params: 'n': int tables: stream - name: drop params: columns: array fn: function tables: stream - name: duplicate params: as: string column: string tables: stream - name: duration params: v: invalid - name: elapsed params: columnName: string tables: stream timeColumn: string unit: duration - name: exponentialMovingAverage params: 'n': int tables: stream - name: fill params: column: string tables: stream usePrevious: bool value: invalid - name: filter params: fn: function onEmpty: string tables: stream - name: findColumn params: column: string fn: function tables: stream - name: findRecord params: fn: function idx: int tables: stream - name: first params: column: string tables: stream - name: float params: v: invalid - name: from params: bucket: string bucketID: string host: string org: string orgID: string token: string - name: getColumn params: column: string - name: getRecord params: idx: int - name: group params: columns: array mode: string tables: stream - name: highestAverage params: column: string groupColumns: array 'n': int tables: stream - name: highestCurrent params: column: string groupColumns: array 'n': int tables: stream - name: highestMax params: column: string groupColumns: array 'n': int tables: stream - name: histogram params: bins: array column: string countColumn: string normalize: bool tables: stream upperBoundColumn: string - name: histogramQuantile params: countColumn: string minValue: float quantile: float tables: stream upperBoundColumn: string valueColumn: string - name: holtWinters params: column: string interval: duration 'n': int seasonality: int tables: stream timeColumn: string withFit: bool - name: hourSelection params: location: object start: int stop: int tables: stream timeColumn: string - name: increase params: columns: array tables: stream - name: int params: v: invalid - name: integral params: column: string interpolate: string tables: stream timeColumn: string unit: duration - name: join params: method: string 'on': array tables: invalid - name: kaufmansAMA params: column: string 'n': int tables: stream - name: kaufmansER params: 'n': int tables: stream - name: keep params: columns: array fn: function tables: stream - name: keyValues params: keyColumns: array tables: stream - name: keys params: column: string tables: stream - name: last params: column: string tables: stream - name: length params: arr: array - name: limit params: 'n': int offset: int tables: stream - name: linearBins params: count: int infinity: bool start: float width: float - name: logarithmicBins params: count: int factor: float infinity: bool start: float - name: lowestAverage params: column: string groupColumns: array 'n': int tables: stream - name: lowestCurrent params: column: string groupColumns: array 'n': int tables: stream - name: lowestMin params: column: string groupColumns: array 'n': int tables: stream - name: map params: fn: function mergeKey: bool tables: stream - name: max params: column: string tables: stream - name: mean params: column: string tables: stream - name: median params: column: string compression: float method: string tables: stream - name: min params: column: string tables: stream - name: mode params: column: string tables: stream - name: movingAverage params: 'n': int tables: stream - name: now params: {} - name: pearsonr params: 'on': array x: invalid 'y': invalid - name: pivot params: columnKey: array rowKey: array tables: stream valueColumn: string - name: quantile params: column: string compression: float method: string q: float tables: stream - name: range params: start: invalid stop: invalid tables: stream - name: reduce params: fn: function identity: invalid tables: stream - name: relativeStrengthIndex params: columns: array 'n': int tables: stream - name: rename params: columns: invalid fn: function tables: stream - name: sample params: column: string 'n': int pos: int tables: stream - name: set params: key: string tables: stream value: string - name: skew params: column: string tables: stream - name: sort params: columns: array desc: bool tables: stream - name: spread params: column: string tables: stream - name: stateCount params: column: string fn: function tables: stream - name: stateDuration params: column: string fn: function tables: stream timeColumn: string unit: duration - name: stateTracking params: countColumn: string durationColumn: string durationUnit: duration fn: function tables: stream timeColumn: string - name: stddev params: column: string mode: string tables: stream - name: string params: v: invalid - name: sum params: column: string tables: stream - name: tableFind params: fn: function tables: stream - name: tail params: 'n': int offset: int tables: stream - name: time params: v: invalid - name: timeShift params: columns: array duration: duration tables: stream - name: timeWeightedAvg params: tables: stream unit: duration - name: timedMovingAverage params: column: string every: duration period: duration tables: stream - name: to params: bucket: string bucketID: string fieldFn: function host: string measurementColumn: string org: string orgID: string tables: stream tagColumns: array timeColumn: string token: string - name: toBool params: tables: stream - name: toFloat params: tables: stream - name: toInt params: tables: stream - name: toString params: tables: stream - name: toTime params: tables: stream - name: toUInt params: tables: stream - name: today params: {} - name: top params: columns: array 'n': int tables: stream - name: tripleEMA params: 'n': int tables: stream - name: tripleExponentialDerivative params: 'n': int tables: stream - name: truncateTimeColumn params: tables: stream timeColumn: invalid unit: duration - name: uint params: v: invalid - name: union params: tables: array - name: unique params: column: string tables: stream - name: wideTo params: bucket: string bucketID: string host: string org: string orgID: string tables: stream token: string - name: window params: createEmpty: bool every: duration location: object offset: duration period: duration startColumn: string stopColumn: string tables: stream timeColumn: string - name: yield params: name: string tables: stream schema: $ref: '#/components/schemas/FluxSuggestions' description: > Success. The response body contains a list of Flux query suggestions--function names used in the Flux Query Builder autocomplete suggestions. '301': content: text/html: examples: movedPermanently: description: > The URL has been permanently moved. Use `/api/v2/query/suggestions`. summary: Invalid URL value: > Moved Permanently schema: properties: body: description: Response message with URL of requested resource. readOnly: true type: string description: | Moved Permanently. InfluxData has moved the URL of the endpoint. Use `/api/v2/query/suggestions` (without a trailing slash). default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error. summary: List Flux query suggestions tags: - Query data x-codeSamples: - label: cURL lang: Shell source: | curl --request GET "INFLUX_URL/api/v2/query/suggestions" \ --header "Accept: application/json" \ --header "Authorization: Token INFLUX_API_TOKEN" /api/v2/query/suggestions/{name}: get: description: > Retrieves a query suggestion that contains the name and parameters of the requested function. Use this endpoint to pass a branching suggestion (a Flux function name) and retrieve the parameters of the requested function. #### Limitations - Use `/api/v2/query/suggestions/{name}` (without a trailing slash). `/api/v2/query/suggestions/{name}/` (note the trailing slash) results in a HTTP `301 Moved Permanently` status. - The function `name` must exist and must be spelled correctly. #### Related Guides - [List of all Flux functions](https://docs.influxdata.com/flux/v0.x/stdlib/all-functions/) operationId: GetQuerySuggestionsName parameters: - $ref: '#/components/parameters/TraceSpan' - description: > A [Flux function](https://docs.influxdata.com/flux/v0.x/stdlib/all-functions/) name. in: path name: name required: true schema: type: string responses: '200': content: application/json: examples: successResponse: value: name: sum params: column: string tables: stream schema: $ref: '#/components/schemas/FluxSuggestion' description: | Success. The response body contains the function name and parameters. '500': content: application/json: examples: internalError: description: | The requested function doesn't exist. summary: Invalid function value: code: internal error message: An internal error has occurred schema: $ref: '#/components/schemas/Error' description: | Internal server error. The value passed for _`name`_ may have been misspelled. summary: Retrieve a query suggestion for a branching suggestion tags: - Query data x-codeSamples: - label: cURL lang: Shell source: | curl --request GET "INFLUX_URL/api/v2/query/suggestions/sum/" \ --header "Accept: application/json" \ --header "Authorization: Token INFLUX_API_TOKEN" /ready: get: operationId: GetReady parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/Ready' description: The instance is ready default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error servers: [] summary: Get the readiness of an instance at startup tags: - Ready - System information endpoints /api/v2/remotes: get: operationId: GetRemoteConnections parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: query name: orgID required: true schema: type: string - in: query name: name schema: type: string - in: query name: remoteURL schema: format: uri type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/RemoteConnections' description: List of remote connections '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: List all remote connections tags: - RemoteConnections post: operationId: PostRemoteConnection requestBody: content: application/json: schema: $ref: '#/components/schemas/RemoteConnectionCreationRequest' required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/RemoteConnection' description: Remote connection saved '400': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Register a new remote connection tags: - RemoteConnections /api/v2/remotes/{remoteID}: delete: operationId: DeleteRemoteConnectionByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: remoteID required: true schema: type: string responses: '204': description: Remote connection info deleted. '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Delete a remote connection tags: - RemoteConnections get: operationId: GetRemoteConnectionByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: remoteID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/RemoteConnection' description: Remote connection '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Retrieve a remote connection tags: - RemoteConnections patch: operationId: PatchRemoteConnectionByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: remoteID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/RemoteConnectionUpdateRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/RemoteConnection' description: Updated information saved '400': $ref: '#/components/responses/GeneralServerError' '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Update a remote connection tags: - RemoteConnections /api/v2/replications: get: operationId: GetReplications parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID. in: query name: orgID required: true schema: type: string - in: query name: name schema: type: string - in: query name: remoteID schema: type: string - in: query name: localBucketID schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Replications' description: List of replications '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: List all replications tags: - Replications post: operationId: PostReplication parameters: - $ref: '#/components/parameters/TraceSpan' - description: If true, validate the replication, but don't save it. in: query name: validate schema: default: false type: boolean requestBody: content: application/json: schema: $ref: '#/components/schemas/ReplicationCreationRequest' required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Replication' description: Replication saved '204': description: Replication validated, but not saved '400': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Register a new replication tags: - Replications /api/v2/replications/{replicationID}: delete: operationId: DeleteReplicationByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: replicationID required: true schema: type: string responses: '204': description: Replication deleted. '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Delete a replication tags: - Replications get: operationId: GetReplicationByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: replicationID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Replication' description: Replication '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Retrieve a replication tags: - Replications patch: operationId: PatchReplicationByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: replicationID required: true schema: type: string - description: If true, validate the updated information, but don't save it. in: query name: validate schema: default: false type: boolean requestBody: content: application/json: schema: $ref: '#/components/schemas/ReplicationUpdateRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Replication' description: Updated information saved '204': description: Updated replication validated, but not saved '400': $ref: '#/components/responses/GeneralServerError' '404': $ref: '#/components/responses/GeneralServerError' default: $ref: '#/components/responses/GeneralServerError' summary: Update a replication tags: - Replications /api/v2/replications/{replicationID}/validate: post: operationId: PostValidateReplicationByID parameters: - $ref: '#/components/parameters/TraceSpan' - in: path name: replicationID required: true schema: type: string responses: '204': description: Replication is valid '400': $ref: '#/components/responses/GeneralServerError' description: Replication failed validation default: $ref: '#/components/responses/GeneralServerError' summary: Validate a replication tags: - Replications /api/v2/resources: get: operationId: GetResources parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: items: type: string type: array description: All resources targets default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error summary: List all known resources tags: - Resources - System information endpoints /api/v2/restore/bucket/{bucketID}: post: deprecated: true operationId: PostRestoreBucketID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The bucket ID. in: path name: bucketID required: true schema: type: string - in: header name: Content-Type schema: default: application/octet-stream enum: - application/octet-stream type: string requestBody: content: text/plain: schema: format: byte type: string description: Database info serialized as protobuf. required: true responses: '200': content: application/json: schema: format: byte type: string description: ID mappings for shards in bucket. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Overwrite storage metadata for a bucket with shard info from a backup. tags: - Restore /api/v2/restore/bucketMetadata: post: operationId: PostRestoreBucketMetadata parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/BucketMetadataManifest' description: Metadata manifest for a bucket. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/RestoredBucketMappings' description: ID mappings for shards in new bucket. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Create a new bucket pre-seeded with shard info from a backup. tags: - Restore /api/v2/restore/kv: post: operationId: PostRestoreKV parameters: - $ref: '#/components/parameters/TraceSpan' - description: > The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a gzip payload, send `Content-Encoding: gzip` as a request header. in: header name: Content-Encoding schema: default: identity description: >- The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string - in: header name: Content-Type schema: default: application/octet-stream enum: - application/octet-stream type: string requestBody: content: text/plain: schema: format: binary type: string description: Full KV snapshot. required: true responses: '200': content: application/json: schema: properties: token: description: >- token is the root token for the instance after restore (this is overwritten during the restore) type: string type: object description: KV store successfully overwritten. '204': description: KV store successfully overwritten. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Overwrite the embedded KV store on the server with a backed-up snapshot. tags: - Restore /api/v2/restore/shards/{shardID}: post: operationId: PostRestoreShardId parameters: - $ref: '#/components/parameters/TraceSpan' - description: > The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a gzip payload, send `Content-Encoding: gzip` as a request header. in: header name: Content-Encoding schema: default: identity description: >- Specifies that the line protocol in the body is encoded with gzip or not encoded with identity. enum: - gzip - identity type: string - in: header name: Content-Type schema: default: application/octet-stream enum: - application/octet-stream type: string - description: The shard ID. in: path name: shardID required: true schema: type: string requestBody: content: text/plain: schema: format: binary type: string description: TSM snapshot. required: true responses: '204': description: TSM snapshot successfully restored. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Restore a TSM snapshot into a shard. tags: - Restore /api/v2/restore/sql: post: operationId: PostRestoreSQL parameters: - $ref: '#/components/parameters/TraceSpan' - description: > The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a gzip-compressed payload, send `Content-Encoding: gzip` as a request header. in: header name: Content-Encoding schema: default: identity description: >- Specifies that the line protocol in the body is encoded with gzip or not encoded with identity. enum: - gzip - identity type: string - in: header name: Content-Type schema: default: application/octet-stream enum: - application/octet-stream type: string requestBody: content: text/plain: schema: format: binary type: string description: Full SQL snapshot. required: true responses: '204': description: SQL store successfully overwritten. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: >- Overwrite the embedded SQL store on the server with a backed-up snapshot. tags: - Restore /api/v2/scrapers: get: operationId: GetScrapers parameters: - $ref: '#/components/parameters/TraceSpan' - description: Specifies the name of the scraper target. in: query name: name schema: type: string - description: >- List of scraper target IDs to return. If both `id` and `owner` are specified, only `id` is used. in: query name: id schema: items: type: string type: array - description: Specifies the organization ID of the scraper target. in: query name: orgID schema: type: string - description: Specifies the organization name of the scraper target. in: query name: org schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ScraperTargetResponses' description: All scraper targets summary: List all scraper targets tags: - Scraper Targets post: operationId: PostScrapers parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/ScraperTargetRequest' description: Scraper target to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ScraperTargetResponse' description: Scraper target created default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error summary: Create a scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}: delete: operationId: DeleteScrapersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The identifier of the scraper target. in: path name: scraperTargetID required: true schema: type: string responses: '204': description: Scraper target deleted default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error summary: Delete a scraper target tags: - Scraper Targets get: operationId: GetScrapersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The identifier of the scraper target. in: path name: scraperTargetID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ScraperTargetResponse' description: The scraper target default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error summary: Retrieve a scraper target tags: - Scraper Targets patch: operationId: PatchScrapersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The identifier of the scraper target. in: path name: scraperTargetID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/ScraperTargetRequest' description: Scraper target update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/ScraperTargetResponse' description: Scraper target updated default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Internal server error summary: Update a scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}/labels: get: operationId: GetScrapersIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of labels for a scraper target. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a scraper target tags: - Scraper Targets post: operationId: PostScrapersIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The newly added label default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}/labels/{labelID}: delete: operationId: DeleteScrapersIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string - description: The label ID. in: path name: labelID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Scraper target not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a label from a scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}/members: get: operationId: GetScrapersIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResourceMembers' description: A list of scraper target members default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all users with member privileges for a scraper target tags: - Scraper Targets post: operationId: PostScrapersIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: User to add as member required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceMember' description: Member added to scraper targets default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a member to a scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}/members/{userID}: delete: operationId: DeleteScrapersIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of member to remove. in: path name: userID required: true schema: type: string - description: The scraper target ID. in: path name: scraperTargetID 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 scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}/owners: get: operationId: GetScrapersIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResourceOwners' description: A list of scraper target owners default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all owners of a scraper target tags: - Scraper Targets post: operationId: PostScrapersIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The scraper target ID. in: path name: scraperTargetID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: User to add as owner required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' description: Scraper target owner added default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add an owner to a scraper target tags: - Scraper Targets /api/v2/scrapers/{scraperTargetID}/owners/{userID}: delete: operationId: DeleteScrapersIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of owner to remove. in: path name: userID required: true schema: type: string - description: The scraper target ID. in: path name: scraperTargetID 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 scraper target tags: - Scraper Targets /api/v2/setup: get: description: >- Returns `true` if no default user, organization, or bucket has been created. operationId: GetSetup parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': content: application/json: schema: $ref: '#/components/schemas/IsOnboarding' description: allowed true or false summary: Check if database has default user, org, bucket tags: - Setup post: description: Post an onboarding request to set up initial user, org and bucket. operationId: PostSetup parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/OnboardingRequest' description: Source to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/OnboardingResponse' description: Created default user, bucket, org default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Set up initial user, org and bucket tags: - Setup /api/v2/signin: post: description: > Authenticates [Basic authentication credentials](#section/Authentication/BasicAuthentication) for a [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user), and then, if successful, generates a user session. To authenticate a user, pass the HTTP `Authorization` header with the `Basic` scheme and the base64-encoded username and password. For syntax and more information, see [Basic Authentication](#section/Authentication/BasicAuthentication) for syntax and more information. If authentication is successful, InfluxDB creates a new session for the user and then returns the session cookie in the `Set-Cookie` response header. InfluxDB stores user sessions in memory only. They expire within ten minutes and during restarts of the InfluxDB instance. #### User sessions with authorizations - In InfluxDB Cloud, a user session inherits all the user's permissions for the organization. - In InfluxDB OSS, a user session inherits all the user's permissions for all the organizations that the user belongs to. #### Related endpoints - [Signout](#tag/Signout) operationId: PostSignin parameters: - $ref: '#/components/parameters/TraceSpan' responses: '204': description: | Success. The user is authenticated. The `Set-Cookie` response header contains the session cookie. '401': content: application/json: schema: $ref: '#/components/schemas/Error' description: | Unauthorized. This error may be caused by one of the following problems: - The user doesn't have access. - The user passed incorrect credentials in the request. - The credentials are formatted incorrectly in the request. '403': content: application/json: schema: $ref: '#/components/schemas/Error' description: Forbidden. The user account is disabled. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unsuccessful authentication. security: - BasicAuthentication: [] summary: Create a user session. tags: - Security and access endpoints - Signin x-codeSamples: - label: 'cURL: signin with --user option encoding' lang: Shell source: | curl --request POST http://localhost:8086/api/v2/signin \ --user "USERNAME:PASSWORD" /api/v2/signout: post: description: > Expires a user session specified by a session cookie. Use this endpoint to expire a user session that was generated when the user authenticated with the InfluxDB Developer Console (UI) or the `POST /api/v2/signin` endpoint. For example, the `POST /api/v2/signout` endpoint represents the third step in the following three-step process to authenticate a user, retrieve the `user` resource, and then expire the session: 1. Send a request with the user's [Basic authentication credentials](#section/Authentication/BasicAuthentication) to the `POST /api/v2/signin` endpoint to create a user session and generate a session cookie. 2. Send a request to the `GET /api/v2/me` endpoint, passing the stored session cookie from step 1 to retrieve user information. 3. Send a request to the `POST /api/v2/signout` endpoint, passing the stored session cookie to expire the session. _See the complete example in request samples._ InfluxDB stores user sessions in memory only. If a user doesn't sign out, then the user session automatically expires within ten minutes or during a restart of the InfluxDB instance. To learn more about cookies in HTTP requests, see [Mozilla Developer Network (MDN) Web Docs, HTTP cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies). #### Related endpoints - [Signin](#tag/Signin) operationId: PostSignout parameters: - $ref: '#/components/parameters/TraceSpan' responses: '204': description: Success. The session is expired. '401': content: application/json: schema: $ref: '#/components/schemas/Error' description: Unauthorized. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: The session expiry is unsuccessful. summary: Expire a user session tags: - Security and access endpoints - Signout x-codeSamples: - label: >- cURL: sign in a user, verify the user session, and then end the session lang: Shell source: > # The following example shows how to use cURL and the InfluxDB API # to do the following: # 1. Sign in a user with a username and password. # 2. Check that the user session exists for the user. # 3. Sign out the user to expire the session. # 4. Check that the session is no longer active. # 1. Send a request to `POST /api/v2/signin` to sign in the user. # In your request, pass the following: # # - `--user` option with basic authentication credentials. # - `-c` option with a file path where cURL will write cookies. curl --request POST \ -c ./cookie-file.tmp \ "$INFLUX_URL/api/v2/signin" \ --user "${INFLUX_USER_NAME}:${INFLUX_USER_PASSWORD}" # 2. To check that a user session exists for the user in step 1, # send a request to `GET /api/v2/me`. # In your request, pass the `-b` option with the session cookie file path from step 1. curl --request GET \ -b ./cookie-file.tmp \ "$INFLUX_URL/api/v2/me" # InfluxDB responds with the `user` resource. # 3. Send a request to `POST /api/v2/signout` to expire the user session. # In your request, pass the `-b` option with the session cookie file path from step 1. curl --request POST \ -b ./cookie-file.tmp \ "$INFLUX_URL/api/v2/signout" # If the user session is successfully expired, InfluxDB responds with an HTTP `204` status code. # 4. To check that the user session is expired, call `GET /api/v2/me` again, # passing the `-b` option with the cookie file path. curl --request GET \ -b ./cookie-file.tmp \ "$INFLUX_URL/api/v2/me" # If the user session is expired, InfluxDB responds with an HTTP `401` status code. /api/v2/sources: get: operationId: GetSources parameters: - $ref: '#/components/parameters/TraceSpan' - description: The name of the organization. in: query name: org schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Sources' description: A list of sources default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all sources tags: - Sources post: operationId: PostSources parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/Source' description: Source to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Source' description: Created Source default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Create a source tags: - Sources /api/v2/sources/{sourceID}: delete: operationId: DeleteSourcesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The source ID. in: path name: sourceID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: View not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a source tags: - Sources get: operationId: GetSourcesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The source ID. in: path name: sourceID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Source' description: A source '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Source not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a source tags: - Sources patch: operationId: PatchSourcesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The source ID. in: path name: sourceID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Source' description: Source update required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Source' description: Created Source '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Source not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a Source tags: - Sources /api/v2/sources/{sourceID}/buckets: get: operationId: GetSourcesIDBuckets parameters: - $ref: '#/components/parameters/TraceSpan' - description: The source ID. in: path name: sourceID required: true schema: type: string - description: The name of the organization. in: query name: org schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Buckets' description: A source '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Source not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Get buckets in a source tags: - Sources - Buckets /api/v2/sources/{sourceID}/health: get: operationId: GetSourcesIDHealth parameters: - $ref: '#/components/parameters/TraceSpan' - description: The source ID. in: path name: sourceID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/HealthCheck' description: The source is healthy '503': content: application/json: schema: $ref: '#/components/schemas/HealthCheck' description: The source is not healthy default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Get the health of a source tags: - Sources /api/v2/stacks: get: description: > Lists installed InfluxDB stacks. To limit stacks in the response, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all installed stacks for the organization. #### Related guides - [View InfluxDB stacks](https://docs.influxdata.com/influxdb/v2/influxdb-templates/stacks/). operationId: ListStacks parameters: - description: > An organization ID. Only returns stacks owned by the specified [organization](https://docs.influxdata.com/influxdb/v2/reference/glossary/#organization). #### InfluxDB Cloud - Doesn't require this parameter; InfluxDB only returns resources allowed by the API token. in: query name: orgID required: true schema: type: string - description: > A stack name. Finds stack `events` with this name and returns the stacks. Repeatable. To filter for more than one stack name, repeat this parameter with each name--for example: - `INFLUX_URL/api/v2/stacks?&orgID=INFLUX_ORG_ID&name=project-stack-0&name=project-stack-1` examples: findStackByName: summary: Find stacks with the event name value: project-stack-0 in: query name: name schema: type: string - description: > A stack ID. Only returns the specified stack. Repeatable. To filter for more than one stack ID, repeat this parameter with each ID--for example: - `INFLUX_URL/api/v2/stacks?&orgID=INFLUX_ORG_ID&stackID=09bd87cd33be3000&stackID=09bef35081fe3000` examples: findStackByID: summary: Find a stack with the ID value: 09bd87cd33be3000 in: query name: stackID schema: type: string responses: '200': content: application/json: schema: properties: stacks: items: $ref: '#/components/schemas/Stack' type: array type: object description: Success. The response body contains the list of stacks. '400': content: application/json: examples: orgIdMissing: summary: The orgID query parameter is missing value: code: invalid message: >- organization id[""] is invalid: id must have a length of 16 bytes 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 v2 - Returns this error if an incorrect value is passed in the `org` parameter or `orgID` parameter. '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List installed stacks tags: - Templates post: description: > Creates or initializes a stack. Use this endpoint to _manually_ initialize a new stack with the following optional information: - Stack name - Stack description - URLs for template manifest files To automatically create a stack when applying templates, use the [/api/v2/templates/apply endpoint](#operation/ApplyTemplate). #### Required permissions - `write` permission for the organization #### Related guides - [Initialize an InfluxDB stack](https://docs.influxdata.com/influxdb/v2/influxdb-templates/stacks/init/). - [Use InfluxDB templates](https://docs.influxdata.com/influxdb/v2/influxdb-templates/use/#apply-templates-to-an-influxdb-instance). operationId: CreateStack requestBody: content: application/json: schema: properties: description: type: string name: type: string orgID: type: string urls: items: type: string type: array title: PostStackRequest type: object description: The stack to create. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Stack' description: Success. Returns the newly created stack. '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: Create a stack tags: - Templates /api/v2/stacks/{stack_id}: delete: operationId: DeleteStack parameters: - description: The identifier of the stack. in: path name: stack_id required: true schema: type: string - description: The identifier of the organization. in: query name: orgID required: true schema: type: string responses: '204': description: The stack and its associated resources were deleted. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a stack and associated resources tags: - Templates get: operationId: ReadStack parameters: - description: The identifier of the stack. in: path name: stack_id required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Stack' description: Returns the stack. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a stack tags: - Templates patch: operationId: UpdateStack parameters: - description: The identifier of the stack. in: path name: stack_id required: true schema: type: string requestBody: content: application/json: schema: properties: additionalResources: items: properties: kind: type: string resourceID: type: string templateMetaName: type: string required: - kind - resourceID type: object type: array description: nullable: true type: string name: nullable: true type: string templateURLs: items: type: string nullable: true type: array title: PatchStackRequest type: object description: The stack to update. required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Stack' description: Returns the updated stack. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a stack tags: - Templates /api/v2/stacks/{stack_id}/uninstall: post: operationId: UninstallStack parameters: - description: The identifier of the stack. in: path name: stack_id required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Stack' description: Returns the uninstalled stack. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Uninstall a stack tags: - Templates /api/v2/tasks: get: description: > Retrieves a list of [tasks](https://docs.influxdata.com/influxdb/v2/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`. #### Related guide - [Process data with InfluxDB tasks](https://docs.influxdata.com/influxdb/v2/process-data/) operationId: GetTasks parameters: - $ref: '#/components/parameters/TraceSpan' - description: > A [task](https://docs.influxdata.com/influxdb/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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. in: query name: limit schema: default: 100 maximum: 500 minimum: 1 type: integer - description: > A [task](https://docs.influxdata.com/influxdb/v2/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 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} from(bucket: "iot_center") |> range(start: -90d) |> filter(fn: (r) => r._measurement == "environment") |> 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 tasks tags: - Tasks x-codeSamples: - label: 'cURL: all tasks, basic output' lang: Shell source: | curl https://localhost:8086/api/v2/tasks/?limit=-1&type=basic \ --header 'Content-Type: application/json' \ --header 'Authorization: Token INFLUX_API_TOKEN' post: description: > Creates a [task](https://docs.influxdata.com/influxdb/v2/reference/glossary/#task) and returns the task. #### Related guides - [Get started with tasks](https://docs.influxdata.com/influxdb/v2/process-data/get-started/) - [Create a task](https://docs.influxdata.com/influxdb/v2/process-data/manage-tasks/create-task/) - [Common tasks](https://docs.influxdata.com/influxdb/v2/process-data/common-tasks/) - [Task configuration options](https://docs.influxdata.com/influxdb/v2/process-data/task-options/) 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 task. '400': content: application/json: examples: missingFluxError: summary: Task in request body is missing Flux query value: code: invalid message: 'failed to decode request: missing flux' 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 v2 - Returns this error if an incorrect value is passed for `org` or `orgID`. '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 task' lang: Shell source: | curl http://localhost:8086/api/v2/tasks \ --header "Content-type: application/json" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --data-binary @- << EOF { "orgID": "INFLUX_ORG_ID", "description": "IoT Center 30d environment average.", "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ from(bucket: \"iot_center\")\ |> range(start: -30d)\ |> filter(fn: (r) => r._measurement == \"environment\")\ |> aggregateWindow(every: 1h, fn: mean)" } EOF /api/v2/tasks/{taskID}: delete: description: > Deletes a 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: The ID of the task to delete. in: path name: taskID required: true schema: type: string responses: '204': description: Success. The task and 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/v2/reference/glossary/#task). operationId: GetTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of 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 and then cancels all scheduled runs of the task. Use this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`). Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. operationId: PatchTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the task to update. in: path name: taskID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/TaskUpdateRequest' description: An object that contains updated task properties 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/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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. #### InfluxDB Cloud - Always returns this error; doesn't support cancelling tasks. #### InfluxDB OSS v2 - Doesn't return this error. '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/v2/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/v2/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/v2/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/v2/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 /api/v2/telegraf/plugins: get: operationId: GetTelegrafPlugins parameters: - $ref: '#/components/parameters/TraceSpan' - description: The type of plugin desired. in: query name: type schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/TelegrafPlugins' description: A list of Telegraf plugins. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all Telegraf plugins tags: - Telegraf Plugins /api/v2/telegrafs: get: operationId: GetTelegrafs parameters: - $ref: '#/components/parameters/TraceSpan' - description: The organization ID the Telegraf config belongs to. in: query name: orgID schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Telegrafs' description: A list of Telegraf configurations default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all Telegraf configurations tags: - Telegrafs post: operationId: PostTelegrafs parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/TelegrafPluginRequest' description: Telegraf configuration to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Telegraf' description: Telegraf configuration created default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Create a Telegraf configuration tags: - Telegrafs /api/v2/telegrafs/{telegrafID}: delete: operationId: DeleteTelegrafsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf configuration ID. in: path name: telegrafID required: true schema: type: string responses: '204': description: Delete has been accepted default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a Telegraf configuration tags: - Telegrafs get: operationId: GetTelegrafsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf configuration ID. in: path name: telegrafID required: true schema: type: string - in: header name: Accept required: false schema: default: application/toml enum: - application/toml - application/json - application/octet-stream type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Telegraf' application/octet-stream: example: |- [agent] interval = "10s" schema: type: string application/toml: example: |- [agent] interval = "10s" schema: type: string description: Telegraf configuration details default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Retrieve a Telegraf configuration tags: - Telegrafs put: operationId: PutTelegrafsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf config ID. in: path name: telegrafID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/TelegrafPluginRequest' description: Telegraf configuration update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Telegraf' description: An updated Telegraf configurations default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Update a Telegraf configuration tags: - Telegrafs /api/v2/telegrafs/{telegrafID}/labels: get: operationId: GetTelegrafsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf config ID. in: path name: telegrafID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of all labels for a Telegraf config default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a Telegraf config tags: - Telegrafs post: operationId: PostTelegrafsIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf config ID. in: path name: telegrafID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The label added to the Telegraf config default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a Telegraf config tags: - Telegrafs /api/v2/telegrafs/{telegrafID}/labels/{labelID}: delete: operationId: DeleteTelegrafsIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf config ID. in: path name: telegrafID required: true schema: type: string - description: The label ID. in: path name: labelID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Telegraf config not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a label from a Telegraf config tags: - Telegrafs /api/v2/telegrafs/{telegrafID}/members: get: operationId: GetTelegrafsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf config ID. in: path name: telegrafID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResourceMembers' description: A list of Telegraf config members default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all users with member privileges for a Telegraf config tags: - Telegrafs post: operationId: PostTelegrafsIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf config ID. in: path name: telegrafID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: User to add as member required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceMember' description: Member added to Telegraf config default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a member to a Telegraf config tags: - Telegrafs /api/v2/telegrafs/{telegrafID}/members/{userID}: delete: operationId: DeleteTelegrafsIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the member to remove. in: path name: userID required: true schema: type: string - description: The Telegraf config ID. in: path name: telegrafID 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 Telegraf config tags: - Telegrafs /api/v2/telegrafs/{telegrafID}/owners: get: operationId: GetTelegrafsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf configuration ID. in: path name: telegrafID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResourceOwners' description: Returns Telegraf configuration owners as a ResourceOwners list default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all owners of a Telegraf configuration tags: - Telegrafs post: operationId: PostTelegrafsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - description: The Telegraf configuration ID. in: path name: telegrafID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' description: User to add as owner required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' description: >- Telegraf configuration owner was added. Returns a ResourceOwner that references the User. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add an owner to a Telegraf configuration tags: - Telegrafs /api/v2/telegrafs/{telegrafID}/owners/{userID}: delete: operationId: DeleteTelegrafsIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the owner to remove. in: path name: userID required: true schema: type: string - description: The Telegraf config ID. in: path name: telegrafID 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 Telegraf config tags: - Telegrafs /api/v2/templates/apply: post: description: > Applies a template to create or update a [stack](https://docs.influxdata.com/influxdb/v2/influxdb-templates/stacks/) of InfluxDB [resources](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/export/all/#resources). The response contains the diff of changes and the stack ID. Use this endpoint to install an InfluxDB template to an organization. Provide template URLs or template objects in your request. To customize which template resources are installed, use the `actions` parameter. By default, when you apply a template, InfluxDB installs the template to create and update stack resources and then generates a diff of the changes. If you pass `dryRun: true` in the request body, InfluxDB validates the template and generates the resource diff, but doesn’t make any changes to your instance. #### Custom values for templates - Some templates may contain [environment references](https://docs.influxdata.com/influxdb/v2/influxdb-templates/create/#include-user-definable-resource-names) for custom metadata. To provide custom values for environment references, pass the _`envRefs`_ property in the request body. For more information and examples, see how to [define environment references](https://docs.influxdata.com/influxdb/v2/influxdb-templates/use/#define-environment-references). - Some templates may contain queries that use [secrets](https://docs.influxdata.com/influxdb/v2/security/secrets/). To provide custom secret values, pass the _`secrets`_ property in the request body. Don't expose secret values in templates. For more information, see [how to pass secrets when installing a template](https://docs.influxdata.com/influxdb/v2/influxdb-templates/use/#pass-secrets-when-installing-a-template). #### Required permissions - `write` permissions for resource types in the template. #### Rate limits (with InfluxDB Cloud) - Adjustable service quotas apply. For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). #### Related guides - [Use templates](https://docs.influxdata.com/influxdb/v2/influxdb-templates/use/) - [Stacks](https://docs.influxdata.com/influxdb/v2/influxdb-templates/stacks/) operationId: ApplyTemplate requestBody: content: application/json: examples: skipKindAction: summary: Skip all bucket and task resources in the provided templates value: actions: - action: skipKind properties: kind: Bucket - action: skipKind properties: kind: Task orgID: INFLUX_ORG_ID templates: - contents: - '[object Object]': null skipResourceAction: summary: Skip specific resources in the provided templates value: actions: - action: skipResource properties: kind: Label resourceTemplateName: foo-001 - action: skipResource properties: kind: Bucket resourceTemplateName: bar-020 - action: skipResource properties: kind: Bucket resourceTemplateName: baz-500 orgID: INFLUX_ORG_ID templates: - contents: - apiVersion: influxdata.com/v2alpha1 kind: Bucket metadata: name: baz-500 templateObjectEnvRefs: summary: envRefs for template objects value: envRefs: docker-bucket: MY_DOCKER_BUCKET docker-spec-1: MY_DOCKER_SPEC linux-cpu-label: MY_CPU_LABEL orgID: INFLUX_ORG_ID templates: - contents: - apiVersion: influxdata.com/v2alpha1 kind: Label metadata: name: envRef: key: linux-cpu-label spec: color: '#326BBA' name: inputs.cpu - contents: - apiVersion: influxdata.com/v2alpha1 kind: Bucket metadata: name: envRef: key: docker-bucket schema: $ref: '#/components/schemas/TemplateApply' application/x-jsonnet: schema: $ref: '#/components/schemas/TemplateApply' text/yml: schema: $ref: '#/components/schemas/TemplateApply' description: | Parameters for applying templates. required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/TemplateSummary' description: | Success. The template dry run succeeded. The response body contains a resource diff of changes that the template would have made if installed. No resources were created or updated. The diff and summary won't contain IDs for resources that didn't exist at the time of the dry run. '201': content: application/json: schema: $ref: '#/components/schemas/TemplateSummary' description: > Success. The template applied successfully. The response body contains the stack ID, a diff, and a summary. The diff compares the initial state to the state after the template installation. The summary contains newly created resources. '422': content: application/json: schema: allOf: - $ref: '#/components/schemas/TemplateSummary' - properties: code: type: string message: type: string required: - message - code type: object description: | Unprocessable entity. The error may indicate one of the following problems: - The template failed validation. - You passed a parameter combination that InfluxDB doesn't support. '500': content: application/json: examples: createExceedsQuota: summary: 'InfluxDB Cloud: Creating resource would exceed quota.' value: code: internal error message: "resource_type=\"tasks\" err=\"failed to apply resource\"\n\tmetadata_name=\"alerting-gates-b84003\" err_msg=\"failed to create tasks[\\\"alerting-gates-b84003\\\"]: creating task would exceed quota\"" schema: $ref: '#/components/schemas/Error' description: | Internal server error. #### InfluxDB Cloud - Returns this error if creating one of the template resources (bucket, dashboard, task, user) exceeds your plan’s adjustable service quotas. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Apply or dry-run a template tags: - Templates x-codeSamples: - label: 'cURL: Dry run with a remote template' lang: Shell source: | curl --request POST "http://localhost:8086/api/v2/templates/apply" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --data @- << EOF { "dryRun": true, "orgID": "INFLUX_ORG_ID", "remotes": [ { "url": "https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml" } ] } EOF - label: 'cURL: Apply with secret values' lang: Shell source: | curl "http://localhost:8086/api/v2/templates/apply" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --data @- << EOF | jq . { "orgID": "INFLUX_ORG_ID", "secrets": { "SLACK_WEBHOOK": "YOUR_SECRET_WEBHOOK_URL" }, "remotes": [ { "url": "https://raw.githubusercontent.com/influxdata/community-templates/master/fortnite/fn-template.yml" } ] } EOF - label: 'cURL: Apply template objects with environment references' lang: Shell source: | curl --request POST "http://localhost:8086/api/v2/templates/apply" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --data @- << EOF { "orgID": "INFLUX_ORG_ID", "envRefs": { "linux-cpu-label": "MY_CPU_LABEL", "docker-bucket": "MY_DOCKER_BUCKET", "docker-spec-1": "MY_DOCKER_SPEC" }, "templates": [ { "contents": [{ "apiVersion": "influxdata.com/v2alpha1", "kind": "Label", "metadata": { "name": { "envRef": { "key": "linux-cpu-label" } } }, "spec": { "color": "#326BBA", "name": "inputs.cpu" } }] }, "templates": [ { "contents": [{ "apiVersion": "influxdata.com/v2alpha1", "kind": "Label", "metadata": { "name": { "envRef": { "key": "linux-cpu-label" } } }, "spec": { "color": "#326BBA", "name": "inputs.cpu" } }] }, { "contents": [{ "apiVersion": "influxdata.com/v2alpha1", "kind": "Bucket", "metadata": { "name": { "envRef": { "key": "docker-bucket" } } } }] } ] } EOF /api/v2/templates/export: post: operationId: ExportTemplate requestBody: content: application/json: schema: oneOf: - $ref: '#/components/schemas/TemplateExportByID' - $ref: '#/components/schemas/TemplateExportByName' description: Export resources as an InfluxDB template. required: false responses: '200': content: application/json: schema: $ref: '#/components/schemas/Template' application/x-yaml: schema: $ref: '#/components/schemas/Template' description: >- The template was created successfully. Returns the newly created template. default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Export a new template tags: - Templates /api/v2/users: get: description: > Lists [users](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). Default limit is `20`. To limit which users are returned, pass query parameters in your request. #### Required permissions for InfluxDB OSS | Action | Permission required | Restriction | |:-------|:--------------------|:------------| | List all users | _[Operator token](https://docs.influxdata.com/influxdb/v2/security/tokens/#operator-token)_ | | | List a specific user | `read-users` or `read-user USER_ID` | | *`USER_ID`* is the ID of the user that you want to retrieve. #### Related guides - [View users](https://docs.influxdata.com/influxdb/v2/users/view-users/). operationId: GetUsers parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/After' - description: > A user name. Only lists the specified [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). in: query name: name schema: type: string - description: > A user ID. Only lists the specified [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). in: query name: id schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Users' description: Success. The response contains a list of `users`. '401': content: application/json: examples: tokenNotAuthorized: summary: API token doesn't have `write:users` permission value: code: unauthorized message: write:users/09d8462ce0764000 is unauthorized schema: $ref: '#/components/schemas/Error' description: | Unauthorized. '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: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: List users tags: - Security and access endpoints - Users post: description: > Creates a [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) that can access InfluxDB. Returns the user. Use this endpoint to create a user that can sign in to start a user session through one of the following interfaces: - InfluxDB UI - `/api/v2/signin` InfluxDB API endpoint - InfluxDB CLI This endpoint represents the first two steps in a four-step process to allow a user to authenticate with a username and password, and then access data in an organization: 1. Create a user: send a `POST` request to `POST /api/v2/users`. The `name` property is required. 2. Extract the user ID (`id` property) value from the API response for _step 1_. 3. Create an authorization (and API token) for the user: send a `POST` request to [`POST /api/v2/authorizations`](#operation/PostAuthorizations), passing the user ID (`id`) from _step 2_. 4. Create a password for the user: send a `POST` request to [`POST /api/v2/users/USER_ID/password`](#operation/PostUsersIDPassword), passing the user ID from _step 2_. #### Required permissions | Action | Permission required | Restriction | |:-------|:--------------------|:------------| | Create a user | _[Operator token](https://docs.influxdata.com/influxdb/v2/security/tokens/#operator-token)_ | | #### Related guides - [Create a user](https://docs.influxdata.com/influxdb/v2/users/create-user/) - [Create an API token scoped to a user](https://docs.influxdata.com/influxdb/v2/security/tokens/create-token/#create-a-token-scoped-to-a-user) operationId: PostUsers parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/User' description: The user to create. required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/UserResponse' description: | Success. The response body contains the user. '401': content: application/json: examples: tokenNotAuthorized: summary: API token doesn't have `write:users` permission value: code: unauthorized message: write:users/09d8462ce0764000 is unauthorized schema: $ref: '#/components/schemas/Error' description: | Unauthorized. '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: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Create a user tags: - Users x-codeSamples: - label: 'cURL: create a user and set a password' lang: Shell source: > # The following steps show how to create a user and then set # the user's password: # # 1. Send a request to this endpoint to create a user--for example: USER=$(curl --request POST \ "INFLUX_URL/api/v2/users/" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header 'Content-type: application/json' \ --data-binary @- << EOF { "name": "USER_NAME", "status": "active" } EOF ) # 2. Extract the id property from the response in step 1--for example: USER_ID=`echo $USER | jq -r '.id'` # 3. To set the user's password, set the password property in a request # to the /api/v2/users/USER_ID/password endpoint--for example: curl request POST "INFLUX_URL/api/v2/users/$USER_ID/password/" \ --header "Authorization: Token INFLUX_API_TOKEN" \ --header 'Content-type: application/json' \ --data '{ "password": "USER_PASSWORD" }' /api/v2/users/{userID}: delete: description: > Deletes a [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). #### Required permissions | Action | Permission required | |:------------|:-----------------------------------------------| | Delete a user | `write-users` or `write-user USER_ID` | *`USER_ID`* is the ID of the user that you want to delete. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/organizations/users/) operationId: DeleteUsersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: > A user ID. Specifies the [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) to delete. in: path name: userID required: true schema: type: string responses: '204': description: Success. The user is deleted. '400': content: application/json: schema: $ref: '#/components/schemas/Error' description: | Bad request. The response body contains detail about the error. '401': $ref: '#/components/responses/AuthorizationError' '500': $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Delete a user tags: - Users get: description: > Retrieves a [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/organizations/users/) operationId: GetUsersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: > A user ID. Retrieves the specified [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user). in: path name: userID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/UserResponse' description: Success. The response body contains the user. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Retrieve a user tags: - Security and access endpoints - Users patch: description: > Updates a [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) and returns the user. #### Required permissions | Action | Permission required | |:------------|:-----------------------------------------------| | Update a user | `write-users` or `write-user USER_ID` | *`USER_ID`* is the ID of the user that you want to update. #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/v2/organizations/users/) operationId: PatchUsersID parameters: - $ref: '#/components/parameters/TraceSpan' - description: > A user ID. Specifies the [user](https://docs.influxdata.com/influxdb/v2/reference/glossary/#user) to update. in: path name: userID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/User' description: In the request body, provide the user properties to update. required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/UserResponse' description: | Success. The response body contains the user. '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 user tags: - Users /api/v2/users/{userID}/password: post: description: > Updates a user password. #### InfluxDB Cloud - Doesn't allow you to manage user passwords through the API. Use the InfluxDB Cloud user interface (UI) to update a password. #### Related guides - [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) - [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/v2/users/change-password/) operationId: PostUsersIDPassword parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the user to set the password for. in: path name: userID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/PasswordResetBody' description: The new password to set for the user. required: true responses: '204': description: Success. The password is updated. '400': content: application/json: examples: updatePasswordNotAllowed: summary: Cloud API can't update passwords value: code: invalid message: passwords cannot be changed through the InfluxDB Cloud API schema: $ref: '#/components/schemas/Error' description: > Bad request. #### InfluxDB Cloud - Doesn't allow you to manage passwords through the API; always responds with this status. #### InfluxDB OSS v2 - Doesn't understand a value passed in the request. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Update a password tags: - Security and access endpoints - Users x-codeSamples: - label: 'cURL: use HTTP POST to update the user password' lang: Shell source: | curl --request POST \ "http://localhost:8086/api/v2/users/USER_ID/password" \ --header 'Content-type: application/json' \ --header "Authorization: Token INFLUX_TOKEN" \ --data-binary @- << EOF {"password": "NEW_USER_PASSWORD"} EOF put: description: > Updates a user password. Use this endpoint to let a user authenticate with [Basic authentication credentials](#section/Authentication/BasicAuthentication) and set a new password. #### InfluxDB Cloud - Doesn't allow you to manage user passwords through the API. Use the InfluxDB Cloud user interface (UI) to update a password. #### Related guides - [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) - [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/v2/users/change-password/) operationId: PutUsersIDPassword parameters: - $ref: '#/components/parameters/TraceSpan' - description: The ID of the user to set the password for. in: path name: userID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/PasswordResetBody' description: The new password to set for the user. required: true responses: '204': description: Success. The password is updated. '400': content: application/json: examples: updatePasswordNotAllowed: summary: Cloud API can't update passwords value: code: invalid message: passwords cannot be changed through the InfluxDB Cloud API schema: $ref: '#/components/schemas/Error' description: > Bad request. #### InfluxDB Cloud - Doesn't allow you to manage passwords through the API; always responds with this status. #### InfluxDB OSS v2 - Doesn't understand a value passed in the request. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error security: - BasicAuthentication: [] summary: Update a password tags: - Security and access endpoints - Users x-codeSamples: - label: 'cURL: use Basic auth to update the user password' lang: Shell source: | curl -c ./cookie-file.tmp --request POST \ "http://localhost:8086/api/v2/signin" \ --user "${INFLUX_USER_NAME}:${INFLUX_USER_PASSWORD}" curl -b ./cookie-file.tmp --request PUT \ "http://localhost:8086/api/v2/users/USER_ID/password" \ --header 'Content-type: application/json' \ --data-binary @- << EOF {"password": "NEW_USER_PASSWORD"} EOF /api/v2/variables: get: operationId: GetVariables parameters: - $ref: '#/components/parameters/TraceSpan' - description: The name of the organization. in: query name: org schema: type: string - description: The organization ID. in: query name: orgID schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Variables' description: A list of variables for an organization '400': $ref: '#/components/responses/GeneralServerError' description: Invalid request default: $ref: '#/components/responses/GeneralServerError' description: Internal server error summary: List all variables tags: - Variables post: operationId: PostVariables parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable to create required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable created default: $ref: '#/components/responses/GeneralServerError' description: Internal server error summary: Create a variable tags: - Variables /api/v2/variables/{variableID}: delete: operationId: DeleteVariablesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string responses: '204': description: Variable deleted default: $ref: '#/components/responses/GeneralServerError' description: Internal server error summary: Delete a variable tags: - Variables get: operationId: GetVariablesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable found '404': $ref: '#/components/responses/GeneralServerError' description: Variable not found default: $ref: '#/components/responses/GeneralServerError' description: Internal server error summary: Retrieve a variable tags: - Variables patch: operationId: PatchVariablesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable update to apply required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable updated default: $ref: '#/components/responses/GeneralServerError' description: Internal server error summary: Update a variable tags: - Variables put: operationId: PutVariablesID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable to replace required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Variable' description: Variable updated default: $ref: '#/components/responses/GeneralServerError' description: Internal server error summary: Replace a variable tags: - Variables /api/v2/variables/{variableID}/labels: get: operationId: GetVariablesIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string responses: '200': content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' description: A list of all labels for a variable default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: List all labels for a variable tags: - Variables post: operationId: PostVariablesIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LabelMapping' description: Label to add required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/LabelResponse' description: The newly added label default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Add a label to a variable tags: - Variables /api/v2/variables/{variableID}/labels/{labelID}: delete: operationId: DeleteVariablesIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - description: The variable ID. in: path name: variableID required: true schema: type: string - description: The label ID to delete. in: path name: labelID required: true schema: type: string responses: '204': description: Delete has been accepted '404': content: application/json: schema: $ref: '#/components/schemas/Error' description: Variable not found default: content: application/json: schema: $ref: '#/components/schemas/Error' description: Unexpected error summary: Delete a label from a variable tags: - Variables /api/v2/write: post: description: > Writes data to a bucket. Use this endpoint to send data in [line protocol](https://docs.influxdata.com/influxdb/v2/reference/syntax/line-protocol/) format to InfluxDB. #### InfluxDB Cloud - Does the following when you send a write request: 1. Validates the request and queues the write. 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise. 3. Handles the delete asynchronously and reaches eventual consistency. To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, wait for a success response (HTTP `2xx` status code) before you send the next request. Because writes and deletes are asynchronous, your change might not yet be readable when you receive the response. #### InfluxDB OSS v2 - Validates the request and handles the write synchronously. - If all points were written successfully, responds with HTTP `2xx` status code; otherwise, returns the first line that failed. #### Required permissions - `write-buckets` or `write-bucket BUCKET_ID`. *`BUCKET_ID`* is the ID of the destination bucket. #### Rate limits (with InfluxDB Cloud) `write` rate limits apply. For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). #### Related guides - [Write data with the InfluxDB API](https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/api) - [Optimize writes to InfluxDB](https://docs.influxdata.com/influxdb/v2/write-data/best-practices/optimize-writes/) - [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2/write-data/troubleshoot/) operationId: PostWrite parameters: - $ref: '#/components/parameters/TraceSpan' - description: | The compression applied to the line protocol in the request payload. To send a gzip payload, pass `Content-Encoding: gzip` header. in: header name: Content-Encoding schema: default: identity description: > Content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. enum: - gzip - identity type: string - description: > The format of the data in the request body. To send a line protocol payload, pass `Content-Type: text/plain; charset=utf-8`. in: header name: Content-Type schema: default: text/plain; charset=utf-8 description: > `text/plain` is the content type for line protocol. `UTF-8` is the default character set. enum: - text/plain - text/plain; charset=utf-8 type: string - description: | The size of the entity-body, in bytes, sent to InfluxDB. If the length is greater than the `max body` configuration option, the server responds with status code `413`. in: header name: Content-Length schema: description: The length in decimal number of octets. type: integer - description: > The content type that the client can understand. Writes only return a response body if they fail--for example, due to a formatting problem or quota limit. #### InfluxDB Cloud - Returns only `application/json` for format and limit errors. - Returns only `text/html` for some quota limit errors. #### InfluxDB OSS v2 - Returns only `application/json` for format and limit errors. #### Related guides - [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2/write-data/troubleshoot/) in: header name: Accept schema: default: application/json description: Error content type. enum: - application/json type: string - description: | An organization name or ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Writes data to the bucket in the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or the `orgID` parameter. - If you pass both `orgID` and `org`, they must both be valid. - Writes data to the bucket in the specified organization. in: query name: org required: true schema: description: The organization name or ID. type: string - description: | An organization ID. #### InfluxDB Cloud - Doesn't use the `org` parameter or `orgID` parameter. - Writes data to the bucket in the organization associated with the authorization (API token). #### InfluxDB OSS v2 - Requires either the `org` parameter or the `orgID` parameter. - If you pass both `orgID` and `org`, they must both be valid. - Writes data to the bucket in the specified organization. in: query name: orgID schema: type: string - description: | A bucket name or ID. InfluxDB writes all points in the batch to the specified bucket. in: query name: bucket required: true schema: description: The bucket name or ID. type: string - description: The precision for unix timestamps in the line protocol batch. in: query name: precision schema: $ref: '#/components/schemas/WritePrecision' requestBody: content: text/plain: examples: plain-utf8: value: > airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000 airSensors,sensor_id=TLM0202 temperature=75.30007505999716,humidity=35.651929918691714,co=0.5141876544505826 1630424257000000000 schema: format: byte type: string description: > In the request body, provide data in [line protocol format](https://docs.influxdata.com/influxdb/v2/reference/syntax/line-protocol/). To send compressed data, do the following: 1. Use [gzip](https://www.gzip.org/) to compress the line protocol data. 2. In your request, send the compressed data and the `Content-Encoding: gzip` header. #### Related guides - [Best practices for optimizing writes](https://docs.influxdata.com/influxdb/v2/write-data/best-practices/optimize-writes/) required: true responses: '204': description: > Success. #### InfluxDB Cloud - Validated and queued the request. - Handles the write asynchronously - the write might not have completed yet. #### InfluxDB OSS v2 - Successfully wrote all points in the batch. #### Related guides - [How to check for write errors](https://docs.influxdata.com/influxdb/v2/write-data/troubleshoot/) '400': content: application/json: examples: measurementSchemaFieldTypeConflict: summary: >- (Cloud) field type conflict thrown by an explicit bucket schema value: code: invalid message: >- partial write error (2 written): unable to parse 'air_sensor,service=S1,sensor=L1 temperature="90.5",humidity=70.0 1632850122': schema: field type for field "temperature" not permitted by schema; got String but expected Float orgNotFound: summary: (OSS) organization not found value: code: invalid message: 'failed to decode request body: organization not found' schema: $ref: '#/components/schemas/LineProtocolError' description: > Bad request. The response body contains detail about the error. InfluxDB returns this error if the line protocol data in the request is malformed. The response body contains the first malformed line in the data, and indicates what was expected. #### InfluxDB Cloud - Returns this error for bucket schema conflicts. #### InfluxDB OSS v2 - Returns this error if the `org` parameter or `orgID` parameter doesn't match an organization. '401': $ref: '#/components/responses/AuthorizationError' '404': $ref: '#/components/responses/ResourceNotFoundError' '413': content: application/json: examples: dataExceedsSizeLimitOSS: summary: InfluxDB OSS response value: > {"code":"request too large","message":"unable to read data: points batch is too large"} schema: $ref: '#/components/schemas/LineProtocolLengthError' text/html: examples: dataExceedsSizeLimit: summary: InfluxDB Cloud response value: |