---
title: "Create new database for a source"
method: POST
path: "/sources/{id}/dbs/"
tags: ["databases"]
---

# Create new database for a source

`POST /sources/{id}/dbs/`

## Path parameters

- `id` string, required

## Request body

- Database
  - `name` string, required — The identifying name of the database
  - `duration` string — the duration of the default retention policy
  - `replication` integer — how many copies of the data are stored in the cluster
  - `shardDuration` string — the interval spanned by each shard group
  - `retentionPolicies` RetentionPolicy[]
    - `name` string, required — The identifying name of the retention policy
    - `duration` string, required — the duration of the retention policy
    - `replication` integer, required — how many copies of the data are stored in the cluster
    - `shardDuration` string — the interval spanned by each shard group
    - `default` boolean — Indicates whether this retention policy should be the default
    - `links` object
      - `self` string, url — Self link mapping to this resource
  - `links` object
    - `self` string, url — Self link mapping to this resource
    - `rps` string, url — Link to retention policies for this database
    - `measurements` string, url — Link to measurements for this database

## Response `201`

Database successfully created.

- Database
  - `name` string, required — The identifying name of the database
  - `duration` string — the duration of the default retention policy
  - `replication` integer — how many copies of the data are stored in the cluster
  - `shardDuration` string — the interval spanned by each shard group
  - `retentionPolicies` RetentionPolicy[]
    - `name` string, required — The identifying name of the retention policy
    - `duration` string, required — the duration of the retention policy
    - `replication` integer, required — how many copies of the data are stored in the cluster
    - `shardDuration` string — the interval spanned by each shard group
    - `default` boolean — Indicates whether this retention policy should be the default
    - `links` object
      - `self` string, url — Self link mapping to this resource
  - `links` object
    - `self` string, url — Self link mapping to this resource
    - `rps` string, url — Link to retention policies for this database
    - `measurements` string, url — Link to measurements for this database

## Other responses

- `404` — Data source id does not exist.
- `default` — A processing or an unexpected error.

---

[API](https://skmtc.net/influxdata/apis/chronograf.md) · [All operations](https://skmtc.net/influxdata/apis/chronograf/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/influxdata/chronograf/revisions/ce55d963b4ac/schema)
