# Create a Database Instance

Launch stage: Public Preview

`POST /api/2.0/database/instances`

Create a Database Instance.

API scopes: postgres

## Request body

Instance to create.
- `name` (string, required)
  The name of the instance. This is the unique identifier for the instance.
- `capacity` (string, optional)
  The sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8".
- `stopped` (boolean, optional, Input only)
  Whether to stop the instance. An input only param, see effective_stopped for the output.
- `node_count` (int32, optional, Input only)
  The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to
   1 primary and 0 secondaries. This field is input only, see effective_node_count for the output.
- `enable_readable_secondaries` (boolean, optional, Input only)
  Whether to enable secondaries to serve read-only traffic. Defaults to false.
- `retention_window_in_days` (int32, optional, Input only)
  The retention window for the instance. This is the time window in days
   for which the historical data is retained. The default value is 7 days.
   Valid values are 2 to 35 days.
- `parent_instance_ref` (object, optional, Immutable)
  The ref of the parent instance. This is only available if the instance is
   child instance.
   Input: For specifying the parent instance to create a child instance. Optional.
   Output: Only populated if provided as input to create a child instance.
  - `name` (string, optional)
    Name of the ref database instance.
  - `lsn` (string, optional, Input only)
    User-specified WAL LSN of the ref database instance.
    
     Input: For specifying the WAL LSN to create a child instance. Optional.
     Output: Only populated if provided as input to create a child instance.
  - `branch_time` (string, optional)
    Branch time of the ref database instance.
     For a parent ref instance, this is the point in time on the parent instance from which the
     instance was created.
     For a child ref instance, this is the point in time on the instance from which the child
     instance was created.
     Input: For specifying the point in time to create a child instance. Optional.
     Output: Only populated if provided as input to create a child instance.
- `enable_pg_native_login` (boolean, optional, Input only)
  Whether to enable PG native password login on the instance. Defaults to false.
- `usage_policy_id` (string, optional, Beta, Input only)
  The desired usage policy to associate with the instance.
- `custom_tags` (array of object, optional, Beta, Input only)
  Custom tags associated with the instance. This field is only included on create and update responses.
  - `key` (string, optional, Beta)
    The key of the custom tag.
  - `value` (string, optional, Beta)
    The value of the custom tag.

## Returns

Returns the DatabaseInstance object.

## Response

```json
{
  "uid": "string",
  "name": "string",
  "creator": "string",
  "read_write_dns": "string",
  "creation_time": "string",
  "state": "STARTING",
  "pg_version": "string",
  "capacity": "string",
  "effective_capacity": "string",
  "effective_stopped": true,
  "effective_node_count": 0,
  "effective_enable_readable_secondaries": true,
  "read_only_dns": "string",
  "effective_retention_window_in_days": 0,
  "parent_instance_ref": {
    "uid": "string",
    "name": "string",
    "effective_lsn": "string",
    "branch_time": "string"
  },
  "child_instance_refs": [
    {
      "uid": "string",
      "name": "string",
      "effective_lsn": "string",
      "branch_time": "string"
    }
  ],
  "effective_enable_pg_native_login": true,
  "effective_usage_policy_id": "string",
  "effective_custom_tags": [
    {
      "key": "string",
      "value": "string"
    }
  ]
}
```

