content/influxdb/cloud/admin/buckets/create-bucket.md
Use the InfluxDB user interface (UI), the influx command line interface (CLI),
or the InfluxDB HTTP API to create a bucket.
By default, buckets have an implicit schema-type and a schema that conforms to your data.
To require measurements to have specific columns and data types and prevent non-conforming write requests,
create a bucket with the explicit schema-type.
<span id="create-a-bucket"></span>
{{< tabs-wrapper >}} {{% tabs %}} InfluxDB UI influx CLI InfluxDB API {{% /tabs %}}
<!------------------------------ BEGIN UI CONTENT ----------------------------->{{% tab-content %}}
There are two places you can create a bucket in the UI.
{{< nav-icon "data" >}}
{{< nav-icon "data-explorer" >}}
+ Create Bucket.{{% /tab-content %}}
<!------------------------------- END UI CONTENT ------------------------------> <!----------------------------- BEGIN CLI CONTENT ----------------------------->{{% tab-content %}}
To create a bucket with the influx CLI, use the influx bucket create command
and specify values for the following flags:
-o, --org: Organization name-n, --name: Bucket name
(see Bucket naming restrictions)-r, --retention: Retention period durationThe following example creates a bucket with a retention period of 72 hours:
influx bucket create \
--name my-bucket \
--org {INFLUX_ORG} \
--retention 72h
{{% /tab-content %}}
<!------------------------------ END CLI CONTENT ------------------------------> <!----------------------------- BEGIN API CONTENT ----------------------------->{{% tab-content %}}
To create a bucket with the InfluxDB HTTP API, send a request to the following endpoint:
{{< api-endpoint method="post" endpoint="https://cloud2.influxdata.com/api/v2/buckets" api-ref="/influxdb/cloud/api/#operation/PostBuckets" >}}
Include the following in your request:
Token scheme with your InfluxDB API tokenapplication/jsonThe following example creates a bucket with a retention period of 86,400 seconds, or 24 hours:
{{% get-shared-text "api/v2.0/buckets/oss/create.sh" %}}
For information about InfluxDB API options and response codes, see InfluxDB API Buckets reference documentation.
{{% /tab-content %}}
<!------------------------------ END API CONTENT ------------------------------>{{< /tabs-wrapper >}}
A bucket with the explicit schema-type enforces measurement schemas that you define for the bucket and rejects writes that don't conform to any of the schemas.
Use the influx CLI or InfluxDB HTTP API to create a bucket with the explicit schema-type.
{{< tabs-wrapper >}} {{% tabs %}} influx CLI InfluxDB API {{% /tabs %}}
{{% tab-content %}}
<!------------------------------ BEGIN CLI CONTENT ----------------------------->Use the influx bucket create command and specify the --schema-type=explicit flag:
{{< get-shared-text "bucket-schema/bucket-schema-type.sh" >}}
{{% /tab-content %}} {{% tab-content %}}
<!----------------------------- BEGIN API CONTENT ----------------------------->Use the HTTP API /api/v2/buckets
endpoint and set the schemaType property value to explicit in the request body--for example:
{{< api-endpoint method="post" endpoint="https://cloud2.influxdata.com/api/v2/buckets" api-ref="/influxdb/cloud/api/#operation/PostBuckets" >}}
{
"orgID": "{INFLUX_ORG_ID}",
"name": "my-explicit-bucket",
"description": "My Explicit Bucket",
"rp": "string",
"retentionRules": [
{
"type": "expire",
"everySeconds": 86400,
"shardGroupDurationSeconds": 0
}
],
"schemaType": "explicit"
}
{{% /tab-content %}} {{< /tabs-wrapper >}}
Next, see how to create an explicit bucket schema for a measurement.
Bucket names must adhere to the following naming restrictions:
_)")