---
title: "Create a new database"
method: POST
path: "/v2/databases"
tags: ["DB Lifecycle"]
---

# Create a new database

`POST /v2/databases`

Provisions a database (MongoDB, MySQL, Redis, Postgres, etc.), allocates a public DNS record (`square-cloud-db-<id>.squareweb.app`) pointing to it, and returns the connection URL once.

Available only on Standard, Pro, and Enterprise plans. Memory must be at least the minimum required by the database type and not exceed the caller's available memory.

Rate limited to 1 creation every 3 seconds per user.

## Request body

- object
  - `name` string, required — Display name (1-32 chars, letters/numbers/space/hyphen/underscore).
  - `memory` integer, required — Allocated memory in MB.
  - `type` 'mongo' | 'mysql' | 'redis' | 'postgres', required — Database engine slug.
  - `version` string, required — Version supported for the chosen type. Accepts the full version key or a major/minor prefix (e.g. "8").

## Response `200`

Database created. The returned `password` and `certificate` are shown only once — store them securely.

- object
  - `status` 'success', required
  - `response` DatabaseCreated, required
    - `id` string, required
    - `name` string, required
    - `memory` integer, required — Allocated memory in MB.
    - `cpu` number, required — Allocated CPU shares.
    - `type` 'mongo' | 'mysql' | 'redis' | 'postgres', required
    - `password` string, required — One-time database password. Shown only at creation; cannot be recovered.
    - `certificate` string — Base64-encoded PEM certificate for TLS connections. Returned only when the database type provisions one.
    - `connection_url` string, required — Ready-to-use connection string with the password embedded.
    - `cluster` string, required

## Other responses

- `400` — The request failed input validation, the user has insufficient memory, or the database could not be provisioned.
- `401` — The Authorization header is missing, malformed, or the credentials are not valid.
- `403` — The active plan does not include databases. Upgrade to Standard, Pro, or Enterprise.
- `413` — The request body is larger than the maximum allowed size (100MB).
- `429` — The endpoint enforces its own rate limit and the caller hit the cooldown.
- `500` — Provisioning returned an incomplete response.
- `503` — Database provisioning is temporarily unavailable due to maintenance.

---

[API](https://skmtc.dev/squarecloud/apis/square-cloud-api.md) · [All operations](https://skmtc.dev/squarecloud/apis/square-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/squarecloud/square-cloud-api/revisions/54b7733a6b95/schema)
