---
title: buckets() function
description: buckets() returns a list of buckets in the specified organization.
url: https://docs.influxdata.com/flux/v0/stdlib/influxdata/influxdb/buckets/
estimated_tokens: 1083
product: Flux
version: v0
---

# buckets() function

-   Flux 0.16.0+
-   View InfluxDB support

`buckets()` returns a list of buckets in the specified organization.

##### Function type signature

```js
(
    ?host: string,
    ?org: string,
    ?orgID: string,
    ?token: string,
) => stream[{
    retentionPolicy: string,
    retentionPeriod: int,
    organizationID: string,
    name: string,
    id: string,
}]
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### org

Organization name. Default is the current organization.

*`org` and `orgID` are mutually exclusive*.

### orgID

Organization ID. Default is the ID of the current organization.

*`org` and `orgID` are mutually exclusive*.

### host

URL of the InfluxDB instance.

See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/) or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/). *`host` is required when `org` or `orgID` are specified.*

### token

InfluxDB API token.

*`token` is required when `host`, `org, or` orgID\` are specified.*

## Examples

### List buckets in an InfluxDB organization

```js
buckets(org: "example-org", host: "http://localhost:8086", token: "mYSuP3rSecR37t0k3N")
```

#### Related

-   [InfluxQL - SHOW DATABASES\]()](/influxdb/v1/query_language/explore-schema/#show-databases)

[metadata](/flux/v0/tags/metadata/)
