---
title: "POST /v1/{+parent}/databases"
method: POST
path: "/v1/{+parent}/databases"
tags: ["projects"]
---

# POST /v1/{+parent}/databases

`POST /v1/{+parent}/databases`

Create a database.

## Path parameters

- `parent` string, required

## Query parameters

- `databaseId` string

## Request body

- GoogleFirestoreAdminV1Database — A Cloud Firestore Database.
  - `keyPrefix` string — Output only. The key_prefix for this database. This key_prefix is used, in combination with the project ID ("~") to construct the application ID that is returned from the Cloud Datastore APIs in Google App Engine first generation runtimes. This value may be empty in which case the appid to use for URL-encoded keys is the project_id (eg: foo instead of v~foo).
  - `mongodbCompatibleDataAccessMode` 'DATA_ACCESS_MODE_UNSPECIFIED' | 'DATA_ACCESS_MODE_ENABLED' | 'DATA_ACCESS_MODE_DISABLED' — Optional. The MongoDB compatible API data access mode to use for this database. If not set on write, the default value is DATA_ACCESS_MODE_ENABLED for Enterprise Edition. The value is always DATA_ACCESS_MODE_DISABLED for Standard Edition.
  - `concurrencyMode` 'CONCURRENCY_MODE_UNSPECIFIED' | 'OPTIMISTIC' | 'PESSIMISTIC' | 'OPTIMISTIC_WITH_ENTITY_GROUPS' — The default concurrency control mode to use for this database. If unspecified in a CreateDatabase request, this will default based on the database edition: Optimistic for Enterprise and Pessimistic for all other databases. While transactions can explicitly specify their own concurrency mode, this setting defines the default behavior when left unspecified. Important: This database-level setting is not respected for Firestore with MongoDB compatibility. All transactions through the MongoDB compatibility layer will use optimistic concurrency control, regardless of this setting.
  - `updateTime` string, google-datetime — Output only. The timestamp at which this database was most recently updated. Note this only includes updates to the database resource and not data contained by the database.
  - `cmekConfig` GoogleFirestoreAdminV1CmekConfig — The CMEK (Customer Managed Encryption Key) configuration for a Firestore database. If not present, the database is secured by the default Google encryption key.
    - `kmsKeyName` string — Required. Only keys in the same location as this database are allowed to be used for encryption. For Firestore's nam5 multi-region, this corresponds to Cloud KMS multi-region us. For Firestore's eur3 multi-region, this corresponds to Cloud KMS multi-region europe. See https://cloud.google.com/kms/docs/locations. The expected format is `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
    - `activeKeyVersion` string[] — Output only. Currently in-use [KMS key versions](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions). During [key rotation](https://cloud.google.com/kms/docs/key-rotation), there can be multiple in-use key versions. The expected format is `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{key_version}`.
  - `versionRetentionPeriod` string, google-duration — Output only. The period during which past versions of data are retained in the database. Any read or query can specify a `read_time` within this window, and will read the state of the database at that time. If the PITR feature is enabled, the retention period is 7 days. Otherwise, the retention period is 1 hour.
  - `createTime` string, google-datetime — Output only. The timestamp at which this database was created. Databases created before 2016 do not populate create_time.
  - `uid` string — Output only. The system-generated UUID4 for this Database.
  - `realtimeUpdatesMode` 'REALTIME_UPDATES_MODE_UNSPECIFIED' | 'REALTIME_UPDATES_MODE_ENABLED' | 'REALTIME_UPDATES_MODE_DISABLED' — Immutable. The default Realtime Updates mode to use for this database.
  - `pointInTimeRecoveryEnablement` 'POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED' | 'POINT_IN_TIME_RECOVERY_ENABLED' | 'POINT_IN_TIME_RECOVERY_DISABLED' — Whether to enable the PITR feature on this database.
  - `earliestVersionTime` string, google-datetime — Output only. The earliest timestamp at which older versions of the data can be read from the database. See [version_retention_period] above; this field is populated with `now - version_retention_period`. This value is continuously updated, and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery.
  - `locationId` string — Required. The location of the database. Available locations are listed at https://cloud.google.com/firestore/docs/locations.
  - `deleteProtectionState` 'DELETE_PROTECTION_STATE_UNSPECIFIED' | 'DELETE_PROTECTION_DISABLED' | 'DELETE_PROTECTION_ENABLED' — State of delete protection for the database.
  - `freeTier` boolean — Output only. Background: Free tier is the ability of a Firestore database to use a small amount of resources every day without being charged. Once usage exceeds the free tier limit further usage is charged. Whether this database can make use of the free tier. Only one database per project can be eligible for the free tier. The first (or next) database that is created in a project without a free tier database will be marked as eligible for the free tier. Databases that are created while there is a free tier database will not be eligible for the free tier.
  - `deleteTime` string, google-datetime — Output only. The timestamp at which this database was deleted. Only set if the database has been deleted.
  - `appEngineIntegrationMode` 'APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED' | 'ENABLED' | 'DISABLED' — The App Engine integration mode to use for this database.
  - `previousId` string — Output only. The database resource's prior database ID. This field is only populated for deleted databases.
  - `databaseEdition` 'DATABASE_EDITION_UNSPECIFIED' | 'STANDARD' | 'ENTERPRISE' — Immutable. The edition of the database.
  - `name` string — The resource name of the Database. Format: `projects/{project}/databases/{database}`
  - `type` 'DATABASE_TYPE_UNSPECIFIED' | 'FIRESTORE_NATIVE' | 'DATASTORE_MODE' — Required. The type of the database. See https://cloud.google.com/datastore/docs/firestore-or-datastore for information about how to choose.
  - `tags` object — Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
  - `sourceInfo` GoogleFirestoreAdminV1SourceInfo — Information about the provenance of this database.
    - `backup` GoogleFirestoreAdminV1BackupSource — Information about a backup that was used to restore a database.
      - `backup` string — The resource name of the backup that was used to restore this database. Format: `projects/{project}/locations/{location}/backups/{backup}`.
    - `operation` string — The associated long-running operation. This field may not be set after the operation has completed. Format: `projects/{project}/databases/{database}/operations/{operation}`.
  - `etag` string — This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
  - `firestoreDataAccessMode` 'DATA_ACCESS_MODE_UNSPECIFIED' | 'DATA_ACCESS_MODE_ENABLED' | 'DATA_ACCESS_MODE_DISABLED' — Optional. The Firestore API data access mode to use for this database. If not set on write: - the default value is DATA_ACCESS_MODE_DISABLED for Enterprise Edition. - the default value is DATA_ACCESS_MODE_ENABLED for Standard Edition.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/firestore.md) · [All operations](https://skmtc.net/google/apis/firestore/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/firestore/versions/11bc07a83431/schema)
