---
title: Setup
description: Configure a new InfluxDB OSS v2 instance, including creating the initial user, organization, bucket, and API token.
url: https://docs.influxdata.com/influxdb/v2/api/setup/
estimated_tokens: 1092
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/api/setup/
---

[Download InfluxDB API Spec](/openapi/influxdb-oss-v2-api.yml)

Configure a new InfluxDB OSS v2 instance, including creating the initial user, organization, bucket, and API token.

GET`/api/v2/setup`

### Check if database has default user, org, bucket

Returns `true` if no default user, organization, or bucket has been created.

#### Parameters

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/setup" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200allowed true or false

`allowed`boolean

If `true`, the InfluxDB instance hasn’t had initial setup;`false` otherwise.

POST`/api/v2/setup`

### Set up initial user, org and bucket

Post an onboarding request to set up initial user, org and bucket.

#### Parameters

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

Source to create

Content-Type:`application/json`

`bucket`requiredstring

`org`requiredstring

`password`string

`retentionPeriodHrs`integer

Retention period *in nanoseconds* for the new bucket. This key’s name has been misleading since OSS 2.0 GA, please transition to use `retentionPeriodSeconds`

`retentionPeriodSeconds`integer \<int64\>

`token`string

Authentication token to set on the initial user. If not specified, the server will generate a token.

`username`requiredstring

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/setup" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "bucket": "BUCKET",
  "org": "ORG",
  "password": "PASSWORD",
  "retentionPeriodHrs": 0,
  "retentionPeriodSeconds": 0,
  "token": "TOKEN",
  "username": "USERNAME"
}'
```

#### Responses

201Created default user, bucket, org

`auth`object

`createdAt`string \<date-time\>

`description`string

A description of the token.

`id`string

The authorization ID.

`links`object

Example:`{"self":"/api/v2/authorizations/1","user":"/api/v2/users/12"}`

`self`string \<uri\>

URI of resource.

`user`string \<uri\>

URI of resource.

`org`string

The organization name.
Specifies the [organization](/influxdb/v2/reference/glossary/#organization)that the token is scoped to.

`orgID`requiredstring

The organization ID.
Specifies the [organization](/influxdb/v2/reference/glossary/#organization) that the authorization is scoped to.

`permissions`requiredobject[]

The list of permissions.
An authorization must have at least one permission.

`action`requiredstring

Allowed:`read`, `write`

`resource`requiredobject

`status`string

Status of the token. If `inactive`, InfluxDB rejects requests that use the token.

Allowed:`active`, `inactive`

Default:`active`

`token`string

The API token.
The token value is unique to the authorization.[API tokens](/influxdb/v2/reference/glossary/#token) are
used to authenticate and authorize InfluxDB API requests and `influx`CLI commands–after receiving the request, InfluxDB checks that the
token is valid and that the `permissions` allow the requested action(s).

`updatedAt`string \<date-time\>

`user`string

The user name.
Specifies the [user](/influxdb/v2/reference/glossary/#user) that owns the authorization.
If the authorization is *scoped* to a user, the user;
otherwise, the creator of the authorization.

`userID`string

The user ID. Specifies the [user](/influxdb/v2/reference/glossary/#user) that owns the authorization. If *scoped*, the user that the authorization is scoped to; otherwise, the creator of the authorization.

`bucket`string

`org`string

`user`string

defaultNon 2XX error response from server.

`code`requiredstring

code is the machine-readable error code.

Allowed:`internal error`, `not implemented`, `not found`, `conflict`, `invalid`, `unprocessable entity`, `empty value`, `unavailable`, `forbidden`, `too many requests`, `unauthorized`, `method not allowed`, `request too large`, `unsupported media type`

`err`string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message`string

Human-readable message.

`op`string

Describes the logical code operation when the error occurred. Useful for debugging.

#### Related

* [Set up InfluxDB](/influxdb/v2/get-started/)
