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

# Create database

> Create a new database on a specified cluster. The database is provisioned asynchronously - the initial status will be `creating` and will transition to `ready` once provisioning completes.



## OpenAPI

````yaml https://api.sevalla.com/v3/openapi.json post /databases
openapi: 3.1.0
info:
  title: Sevalla API docs
  version: 1.0.0
servers:
  - url: https://api.sevalla.com/v3
security:
  - bearerAuth: []
paths:
  /databases:
    post:
      tags:
        - Databases
      summary: Create database
      description: >-
        Create a new database on a specified cluster. The database is
        provisioned asynchronously - the initial status will be `creating` and
        will transition to `ready` once provisioning completes.
      operationId: createDatabaseV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                display_name:
                  type: string
                  minLength: 2
                  maxLength: 64
                  description: >-
                    Human-readable name for the new database. Must be between 2
                    and 64 characters.
                  example: My Database
                type:
                  type: string
                  enum:
                    - postgresql
                    - mariadb
                    - mysql
                    - redis
                    - valkey
                  description: >-
                    Database engine type. `postgresql` - PostgreSQL. `mariadb` -
                    MariaDB. `mysql` - MySQL. `redis` - Redis. `valkey` -
                    Valkey.
                  example: postgresql
                version:
                  type: string
                  description: Database engine version to use
                  example: '16'
                cluster_id:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  description: >-
                    Identifier of the cluster (data center location) where the
                    database will be created. Use the List Clusters endpoint to
                    retrieve available options.
                  example: fb5e5168-4281-4bec-94c5-0d1584e9e657
                resource_type_id:
                  type: string
                  description: >-
                    Identifier of the database resource type (machine size). Use
                    the List Database Resource Types endpoint to retrieve
                    available options.
                  example: fb5e5168-4281-4bec-94c5-0d1584e9e657
                db_name:
                  type: string
                  minLength: 2
                  maxLength: 100
                  pattern: ^[a-zA-Z0-9_\-+]+$
                  description: >-
                    Name of the database to create within the server. Must
                    contain only alphanumeric characters, underscores, hyphens,
                    or plus signs.
                  example: my_database
                db_password:
                  type: string
                  minLength: 4
                  maxLength: 100
                  pattern: ^[a-zA-Z0-9_?<>#@\-=+]+$
                  description: >-
                    Password for the database user. Must be between 4 and 100
                    characters and contain only alphanumeric characters and
                    special characters (_?<>#@-=+).
                  example: securePassword123
                db_user:
                  description: >-
                    Username for database authentication. Must be between 2 and
                    32 characters. Cannot be "root" or "postgres". If omitted,
                    the database engine default user is used.
                  example: db_user
                  type: string
                  minLength: 2
                  maxLength: 32
                  pattern: ^[a-zA-Z0-9_\-+]+$
                project_id:
                  description: >-
                    Identifier of the project to group this database under. When
                    omitted, the database is not assigned to any project.
                  example: fb5e5168-4281-4bec-94c5-0d1584e9e657
                  anyOf:
                    - type: string
                      format: uuid
                      pattern: >-
                        ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                    - type: 'null'
                extensions:
                  description: >-
                    PostgreSQL extensions to enable. Only applicable when type
                    is `postgresql`.
                  type: object
                  properties:
                    enable_vector:
                      description: >-
                        Enable the pgvector extension for vector similarity
                        search
                      example: false
                      type: boolean
                    enable_postgis:
                      description: Enable the PostGIS extension for geospatial data
                      example: false
                      type: boolean
                    enable_cron:
                      description: Enable the pg_cron extension for scheduled jobs
                      example: false
                      type: boolean
              required:
                - display_name
                - type
                - version
                - cluster_id
                - resource_type_id
                - db_name
                - db_password
              additionalProperties: false
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                    description: Unique identifier for the database
                    example: fb5e5168-4281-4bec-94c5-0d1584e9e657
                  company_id:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: Identifier of the company that owns this database
                    example: fb5e5168-4281-4bec-94c5-0d1584e9e657
                  project_id:
                    anyOf:
                      - type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      - type: 'null'
                    description: Identifier of the project this database is grouped under
                    example: fb5e5168-4281-4bec-94c5-0d1584e9e657
                  name:
                    type: string
                    description: >-
                      Unique system name used in internal references.
                      Auto-generated from the display name and cannot be changed
                      after creation.
                    example: my-database
                  display_name:
                    type: string
                    description: >-
                      Human-readable name shown in the dashboard and API
                      responses
                    example: My Database
                  type:
                    type: string
                    enum:
                      - postgresql
                      - mariadb
                      - mysql
                      - mongodb
                      - redis
                      - valkey
                    description: >-
                      Database engine type. `postgresql` - PostgreSQL. `mariadb`
                      - MariaDB. `mysql` - MySQL. `redis` - Redis. `valkey` -
                      Valkey.
                    example: postgresql
                  version:
                    type: string
                    description: Database engine version
                    example: '16'
                  status:
                    anyOf:
                      - type: string
                        enum:
                          - creating
                          - ready
                          - updating
                          - passwordChange
                          - passwordChangeFailed
                          - deleting
                          - error
                          - dbDeletionFailed
                          - restoring
                          - restoringFailed
                          - updatingExternalConnection
                      - type: 'null'
                    description: >-
                      Current status of the database reflecting the most recent
                      lifecycle operation
                    example: ready
                  is_suspended:
                    type: boolean
                    description: Whether the database is currently suspended
                    example: false
                  resource_type_name:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      Name of the resource type (machine size) assigned to this
                      database
                    example: db1
                  created_at:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    description: >-
                      Timestamp when the database was created, in ISO 8601
                      format
                    example: '2025-01-30T00:00:00.000Z'
                  updated_at:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                    description: >-
                      Timestamp when the database was last modified, in ISO 8601
                      format
                    example: '2025-01-30T00:00:00.000Z'
                required:
                  - id
                  - company_id
                  - project_id
                  - name
                  - display_name
                  - type
                  - version
                  - status
                  - is_suspended
                  - resource_type_name
                  - created_at
                  - updated_at
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Bad request
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 400
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Unauthorized
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 401
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Forbidden
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 403
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Too many requests
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 429
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Internal Server Error
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 500
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Pass your API key as a Bearer token in the
        Authorization header.

````