---
title: Explore your data schema with Flux
description: Flux provides functions that let you explore the structure and schema of your data stored in InfluxDB.
url: https://docs.influxdata.com/influxdb/cloud/query-data/flux/explore-schema/
estimated_tokens: 4459
product: InfluxDB Cloud (TSM)
version: cloud
---

# Explore your data schema with Flux

Flux provides functions that let you explore the structure and schema of your data stored in InfluxDB.

-   [List buckets](#list-buckets)
-   [List measurements](#list-measurements)
-   [List field keys](#list-field-keys)
-   [List tag keys](#list-tag-keys)
-   [List tag values](#list-tag-values)

Functions in the `schema` package are not supported in the [Flux REPL](/influxdb/cloud/tools/repl/).

## List buckets

Use [`buckets()`](/flux/v0/stdlib/universe/buckets/) to list **buckets in your organization**.

```js
buckets()
```

[](#view-example-buckets-output)

View example `buckets()` output

`buckets()` returns a single table with the following columns:

-   **organizationID**: Organization ID
-   **name**: Bucket name
-   **id**: Bucket ID
-   **retentionPolicy**: Retention policy associated with the bucket
-   **retentionPeriod**: Retention period in nanoseconds

| organizationID | name | id | retentionPolicy | retentionPeriod |
| --- | --- | --- | --- | --- |
| XooX0x0 | _monitoring | XooX0x1 |  | 604800000000000 |
| XooX0x0 | _tasks | XooX0x2 |  | 259200000000000 |
| XooX0x0 | example-bucket-1 | XooX0x3 |  | 0 |
| XooX0x0 | example-bucket-2 | XooX0x4 |  | 0 |
| XooX0x0 | example-bucket-3 | XooX0x5 |  | 172800000000000 |

## List measurements

Use [`schema.measurements()`](/flux/v0/stdlib/influxdata/influxdb/schema/measurements) to list **measurements in a bucket**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.measurements(bucket: "example-bucket")
```

[](#view-example-schemameasurements-output)

View example `schema.measurements()` output

`schema.measurements()` returns a single table with a `_value` column. Each row contains the name of a measurement.

| _value |
| --- |
| m1 |
| m2 |
| m3 |
| m4 |
| m5 |

## List field keys

Use [`schema.fieldKeys`](/flux/v0/stdlib/influxdata/influxdb/schema/fieldkeys) to list **field keys in a bucket**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.fieldKeys(bucket: "example-bucket")
```

[](#view-example-schemafieldkeys-output)

View example `schema.fieldKeys()` output

`schema.fieldKeys()` returns a single table with a `_value` column. Each row contains a unique field key from the specified bucket.

| _value |
| --- |
| field1 |
| field2 |
| field3 |
| field4 |
| field5 |

### List fields in a measurement

Use [`schema.measurementFieldKeys`](/flux/v0/stdlib/influxdata/influxdb/schema/measurementfieldkeys) to list **field keys in a measurement**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.measurementFieldKeys(
    bucket: "example-bucket",
    measurement: "example-measurement",
)
```

[](#view-example-schemameasurementfieldkeys-output)

View example `schema.measurementFieldKeys()` output

`schema.measurementFieldKeys()` returns a single table with a `_value` column. Each row contains the name of a unique field key in the specified bucket and measurement.

| _value |
| --- |
| field1 |
| field2 |
| field3 |
| field4 |
| field5 |

## List tag keys

Use [`schema.tagKeys()`](/flux/v0/stdlib/influxdata/influxdb/schema/tagkeys) to list **tag keys in a bucket**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.tagKeys(bucket: "example-bucket")
```

[](#view-example-schematagkeys-output)

View example `schema.tagKeys()` output

`schema.tagKeys()` returns a single table with a `_value` column. Each row contains the a unique tag key from the specified bucket.

| _value |
| --- |
| tag1 |
| tag2 |
| tag3 |
| tag4 |
| tag5 |

### List tag keys in a measurement

Use [`schema.measurementTagKeys`](/flux/v0/stdlib/influxdata/influxdb/schema/measurementtagkeys) to list **tag keys in a measurement**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.measurementTagKeys(
    bucket: "example-bucket",
    measurement: "example-measurement",
)
```

[](#view-example-schemameasurementtagkeys-output)

View example `schema.measurementTagKeys()` output

`schema.measurementTagKeys()` returns a single table with a `_value` column. Each row contains a unique tag key from the specified bucket and measurement.

| _value |
| --- |
| tag1 |
| tag2 |
| tag3 |
| tag4 |
| tag5 |

## List tag values

Use [`schema.tagValues()`](/flux/v0/stdlib/influxdata/influxdb/schema/tagvalues) to list **tag values for a given tag in a bucket**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.tagValues(bucket: "example-bucket", tag: "example-tag")
```

[](#view-example-schematagvalues-output)

View example `schema.tagValues()` output

`schema.tagValues()` returns a single table with a `_value` column. Each row contains a unique tag value from the specified bucket and tag key.

| _value |
| --- |
| tagValue1 |
| tagValue2 |
| tagValue3 |
| tagValue4 |
| tagValue5 |

### List tag values in a measurement

Use [`schema.measurementTagValues`](/flux/v0/stdlib/influxdata/influxdb/schema/measurementtagvalues) to list **tag values for a given tag in a measurement**. *By default, this function returns results from the last 30 days.*

```js
import "influxdata/influxdb/schema"

schema.measurementTagValues(
    bucket: "example-bucket",
    tag: "example-tag",
    measurement: "example-measurement",
)
```

[](#view-example-schemameasurementtagvalues-output)

View example `schema.measurementTagValues()` output

`schema.measurementTagValues()` returns a single table with a `_value` column. Each row contains a unique tag value from the specified bucket, measurement, and tag key.

| _value |
| --- |
| tagValue1 |
| tagValue2 |
| tagValue3 |
| tagValue4 |
| tagValue5 |

#### Related

-   [schema.measurements() function](/flux/v0/stdlib/influxdata/influxdb/schema/measurements/)
-   [schema.fieldKeys() function](/flux/v0/stdlib/influxdata/influxdb/schema/fieldkeys/)
-   [schema.measurementFieldKeys() function](/flux/v0/stdlib/influxdata/influxdb/schema/measurementfieldkeys/)
-   [schema.tagKeys() function](/flux/v0/stdlib/influxdata/influxdb/schema/tagkeys/)
-   [schema.measurementTagKeys() function](/flux/v0/stdlib/influxdata/influxdb/schema/measurementtagkeys/)
-   [schema.tagValues() function](/flux/v0/stdlib/influxdata/influxdb/schema/tagvalues/)
-   [schema.measurementTagValues() function](/flux/v0/stdlib/influxdata/influxdb/schema/measurementtagvalues/)

[schema](/influxdb/cloud/tags/schema/)
