---
title: "Create database instance"
method: POST
path: "/v2/database_instances"
tags: ["databases"]
---

# Create database instance

`POST /v2/database_instances`

Create a new database instance owned by the organization. Supported engines: `postgresql` (bring-your-own server), `denokv` (Deno-managed key-value), and `prisma` (Prisma-managed Postgres).

## Request body

- DatabaseInstanceInit
  - `slug` string, required — Slug for the new database instance
  - `connection` union, required
    - object
      - `engine` 'postgresql', required
      - `hostname` string, required — Database server hostname
      - `port` integer, nullable, required — Database server port
      - `username` string, nullable, required — Username for authentication
      - `password` string, nullable, required — Password for authentication
      - `certificate` string, nullable, required — Custom CA certificate (PEM). Omit to use the bundled AWS RDS CA bundle
    - object
      - `engine` 'denokv', required
    - object
      - `engine` 'prisma', required
      - `region` string, required — Prisma project region

## Response `200`

OK

- DatabaseInstance
  - `id` string, uuid, required — Unique database instance identifier
  - `slug` string, required — Human-readable instance slug
  - `engine` 'postgresql' | 'denokv' | 'prisma', required — Database engine type
  - `connection` union, required — Non-sensitive connection metadata. Credentials are never returned
    - object
      - `engine` 'postgresql', required
      - `hostname` string, required — Database server hostname
      - `port` integer, nullable, required — Database server port
      - `username` string, nullable, required — Username for authentication
      - `custom_certificate` boolean, required — Whether a custom CA certificate is configured
    - object
      - `engine` 'denokv', required
    - object
      - `engine` 'prisma', required
      - `project_id` string, required — Prisma project identifier
      - `region` string, required — Prisma project region
  - `databases` Database[], required — Databases that exist on this instance
    - `name` string, required — Literal database name
    - `status` 'pending' | 'creating' | 'ready' | 'failed' | 'deleted', required — Provisioning status of the database
    - `created_at` string, required — ISO 8601 timestamp of creation
    - `timelines` DatabaseTimeline[], required — Timelines this database is bound to
      - `app` object, required — The app the timeline belongs to
        - `slug` string, required — App slugs must be 3–32 characters long, may contain only lowercase letters, numbers, and hyphens, cannot contain underscores, must not start or end with a hyphen, must not have consecutive hyphens in positions 3 and 4, and cannot be a reserved slug.
      - `timeline` string, required — Timeline slug derived from the partition config name (e.g. `production`)
      - `partition` object, required — Partition key-value pairs identifying the timeline
  - `created_at` string, required — ISO 8601 timestamp of creation

---

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