> ## Documentation Index
> Fetch the complete documentation index at: https://docs.korve.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Provision

> Provision a named database in the environment (production by default) and issue its credentials. You choose the name, SKU, and region; multiple databases per environment are allowed under distinct names.



## OpenAPI

````yaml /openapi.json post /v1/orgs/{orgId}/projects/{projectId}/databases
openapi: 3.1.0
info:
  title: Korve API
  version: 0.1.0
  description: >-
    Typed control plane for deploying applications and explicitly provisioning
    their managed infrastructure.
servers:
  - url: https://api.korve.dev
security: []
paths:
  /v1/orgs/{orgId}/projects/{projectId}/databases:
    post:
      tags:
        - databases
      summary: Provision
      description: >-
        Provision a named database in the environment (production by default)
        and issue its credentials. You choose the name, SKU, and region;
        multiple databases per environment are allowed under distinct names.
      operationId: databases.provision
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
          description: The organization's id (UUID) or slug — either form is accepted.
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: The project's id (UUID) or slug — either form is accepted.
        - name: environment
          in: query
          required: false
          schema:
            type: string
            pattern: ^[a-z][a-z0-9-]{0,38}$
          description: >-
            Environment slug to scope this operation to. Defaults to
            "production". An environment that does not exist on the project
            answers 404. The database is created in the addressed environment.
      requestBody:
        required: true
        x-korve-max-bytes: 1048576
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  pattern: ^[a-z][a-z0-9-]{1,61}$
                  description: >-
                    Database name: 2-62 chars of lowercase letters, digits, and
                    hyphens, starting with a letter. Unique within the
                    environment.
                sku:
                  type: string
                  description: >-
                    Database SKU id (see the rate card via billing.get). Sizes
                    the dedicated instance. Required — there is no default size.
                region:
                  type: string
                  description: >-
                    Database region id (see regions.list). Required; immutable
                    after provisioning.
                replicas:
                  type: integer
                  enum:
                    - 0
                    - 2
                  description: >-
                    Topology: 0 is single-node; 2 is HA with two replicas.
                    Defaults to 0. HA requires the platform continuous-backup
                    destination to be configured.
              required:
                - name
                - sku
                - region
      responses:
        '201':
          description: >-
            Database provisioned. The connection string is shown once; store it
            securely. Rotate to obtain a new one.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The database's id — addresses it in every other operation.
                  name:
                    type: string
                    pattern: ^[a-z][a-z0-9-]{1,61}$
                    description: >-
                      Customer-chosen database name — unique within the
                      environment. 2-62 chars of lowercase letters, digits, and
                      hyphens, starting with a letter.
                  status:
                    type: string
                    enum:
                      - provisioning
                      - resizing
                      - ready
                      - failed
                  connectionString:
                    type: string
                    description: >-
                      Full postgres:// connection string including the password.
                      Shown exactly once — it is never retrievable later.
                required:
                  - id
                  - name
                  - status
                  - connectionString
        '402':
          description: Organization billing is not active.
        '404':
          description: No such project or environment in this organization.
        '409':
          description: A database with that name already exists in this environment.
        '422':
          description: >-
            Invalid name, unknown or unavailable database region or SKU,
            unsupported replica count, or HA requested before continuous
            recovery is configured.
      security:
        - apiKey: []
        - session: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: korve_api_key
    session:
      type: apiKey
      in: cookie
      name: korve.session_token

````