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

# Create Environment Connection Database

> Give a connection a new database in this environment, such as Warehouse's staging database: creates the database's connection and makes it the connection's database here, in one step. The settings must be of the connection's type; test them first. Workspaces built on the connection then query this database for this environment's users.



## OpenAPI

````yaml post /v2/api/projects/{projectId}/environments/{environment}/connections/{sourceConnectionId}/database
openapi: 3.1.0
info:
  title: Upsolve API
  version: 1.5.0
servers:
  - url: https://api.upsolve.ai
security: []
tags: []
paths:
  /v2/api/projects/{projectId}/environments/{environment}/connections/{sourceConnectionId}/database:
    post:
      summary: Give a connection a new database in this environm…
      description: >-
        Give a connection a new database in this environment, such as
        Warehouse's staging database: creates the database's connection and
        makes it the connection's database here, in one step. The settings must
        be of the connection's type; test them first. Workspaces built on the
        connection then query this database for this environment's users.
      operationId: >-
        PostV2ApiProjectsProjectIdEnvironmentsEnvironmentConnectionsSourceConnectionIdDatabase
      parameters:
        - name: projectId
          in: path
          required: true
          description: The project the environments belong to.
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            description: The project the environments belong to.
        - name: environment
          in: path
          required: true
          description: The environment's slug, e.g. `staging`.
          schema:
            type: string
            description: The environment's slug, e.g. `staging`.
        - name: sourceConnectionId
          in: path
          required: true
          description: >-
            The connection to give a database in this environment: one a
            workspace in this project is built on.
          schema:
            type: string
            description: >-
              The connection to give a database in this environment: one a
              workspace in this project is built on.
      requestBody:
        description: >-
          POST
          /v2/api/projects/:projectId/environments/:environment/connections/:sourceConnectionId/database
          Request body
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKey:
                  type: string
                  minLength: 1
                  description: >-
                    Upsolve API key, generated under Account → Developer
                    settings in the Upsolve Hub. Keys are user-scoped: pass
                    organizationId alongside the key to select which org to act
                    on.
                  examples:
                    - up_embed_************
                organizationId:
                  description: >-
                    Your Upsolve organization's UUID — the org that owns the API
                    key and project. This is NOT a project organization: do not
                    pass a value registered via /projects/register-organization,
                    and do not pass an `externalId` (only
                    `projectOrganizationId` accepts those). Omit it when using
                    an org-bound API key — the org is read from the key and any
                    value sent here is ignored. Required only for user-scoped
                    API keys (created under Account → Developer settings) and
                    for the Supabase JWT path, where the org is ambiguous and
                    membership is verified against it.
                  examples:
                    - 123e4567-e89b-12d3-a456-426614174000
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: The new database's name, for example "Warehouse (Staging)".
                config:
                  oneOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Bigquery
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Clickhouse
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        defaultSchema:
                          description: >-
                            Default database value to be used for admins. When
                            set, schema-based tenancy is enabled and metadata
                            will only include tables from this database. May be
                            a comma-separated list (e.g. 'db1,db2') to scope
                            metadata across multiple databases.
                          type: string
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: MS SQL
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Redshift
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        rlsVariable:
                          description: RLS variable to be used when RLS is enabled.
                          type: string
                        defaultRlsValue:
                          description: Default RLS value to be used when RLS is enabled.
                          type: string
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Snowflake
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        authenticator:
                          description: >-
                            Set to SNOWFLAKE_JWT to sign in with a key pair: the
                            decrypted credential is then used as the PEM private
                            key instead of a password.
                          type: string
                          enum:
                            - SNOWFLAKE_JWT
                        warehouse:
                          description: Snowflake warehouse the session uses for compute.
                          type: string
                        role:
                          description: Snowflake role the session assumes.
                          type: string
                        managedBy:
                          description: >-
                            Set when Upsolve provisioned and owns the database
                            (Easy connect). Deleting the connection then also
                            deletes what it points at.
                          type: string
                          enum:
                            - easy_connect
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Timescale
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Supabase
                        url:
                          type: string
                          description: Supabase project URL
                        key:
                          type: string
                          description: Supabase Anon key
                        serviceKey:
                          description: >-
                            Deprecated and no longer used for authentication —
                            admin queries mint a short-lived token from
                            jwtSecret. Kept as an optional field only for
                            backward compatibility with existing stored configs;
                            the product never reads or writes it, and it is
                            stripped from API responses.
                          type: string
                        isReadReplica:
                          description: >-
                            Whether to use read replica (sets get: true for RPC
                            calls)
                          type: boolean
                        jwtSecret:
                          description: >-
                            Supabase legacy JWT secret (HS256) for minting
                            user-scoped JWTs to enable RLS in preview mode
                          type: string
                        schemas:
                          description: >-
                            Optional comma-separated list of schemas to restrict
                            metadata introspection to (e.g. 'public,analytics').
                            When empty, all non-system schemas are scanned.
                          type: string
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                      required:
                        - type
                        - url
                        - key
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Data plane
                        apiKey:
                          type: string
                          description: Data plane API key
                        defaultSchema:
                          description: >-
                            Default schema value to be used. When set, schema
                            based tenancy is enabled.
                          type: string
                      required:
                        - type
                        - apiKey
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Postgres
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        rlsVariable:
                          description: RLS variable to be used when RLS is enabled.
                          type: string
                        defaultRlsValue:
                          description: Default RLS value to be used when RLS is enabled.
                          type: string
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: MySQL
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        ssl:
                          description: >-
                            Whether to use SSL for the connection. Defaults to
                            true for backward compatibility.
                          type: boolean
                      required:
                        - type
                        - user
                        - host
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Trino
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          type: string
                          description: Connection host address
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        catalog:
                          type: string
                          description: Trino catalog name
                        defaultSchema:
                          description: Default schema in the catalog (e.g. demo, public)
                          type: string
                      required:
                        - type
                        - user
                        - host
                        - catalog
                    - type: object
                      properties:
                        type:
                          type: string
                          const: Athena
                        user:
                          type: string
                          description: Connection username
                        password:
                          description: Connection password
                          type: string
                        credential:
                          description: Connection password (encrypted)
                          type: string
                        host:
                          description: >-
                            Unused for Athena — the AWS SDK resolves the
                            endpoint by region
                          type: string
                        database:
                          description: >-
                            Connection database name. For BigQuery, MS SQL,
                            MySQL, and Clickhouse this may be a comma-separated
                            list (e.g. 'db1,db2') to fetch metadata across
                            multiple databases on the same connection; the first
                            entry is used as the initial catalog. Cross-database
                            references in generated SQL require the connecting
                            login/role to have access to every listed database.
                          type: string
                        port:
                          description: Connection port number
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        bigIntMode:
                          description: Big integer mode configuration
                          type: string
                          enum:
                            - string
                            - number
                            - bigint
                        poolSize:
                          description: The size of the connection pool
                          type: number
                        concurrencyLimit:
                          description: >-
                            The max number of concurrent calls to be made to the
                            db
                          type: number
                        intervalLimit:
                          description: >-
                            The max number of calls that can be made in a
                            certain time interval
                          type: number
                        intervalTime:
                          description: >-
                            The amount of time (ms) that needs to be awaited
                            before a new batch of calls can be made beyond the
                            interval limit
                          type: number
                        requiresSchemaLevelSecurity:
                          description: >-
                            Each customer's data is in a schema of its own with
                            the same tables. The connection's tables are listed
                            once by name, and a data model's Schema Rule chooses
                            the customer's schema when a query runs.
                          type: boolean
                        region:
                          type: string
                          description: >-
                            AWS region hosting the Athena workgroup (e.g.
                            us-east-1)
                        outputLocation:
                          type: string
                          description: >-
                            S3 URI where Athena writes query results, e.g.
                            s3://my-bucket/athena-results/. Required: the IAM
                            principal must be able to write here and read back
                            the result object.
                        workgroup:
                          description: >-
                            Athena workgroup to run queries in. Defaults to
                            'primary'.
                          type: string
                        catalog:
                          description: >-
                            Glue data catalog to resolve tables against.
                            Defaults to 'AwsDataCatalog'.
                          type: string
                        schemas:
                          description: >-
                            Optional comma-separated list of schemas to restrict
                            metadata introspection to (e.g.
                            'dw,domain_*_mart*'). Supports '*' wildcards. When
                            empty, every schema in the catalog is scanned — on a
                            catalog with thousands of schemas that is slow and
                            rarely intended. Independent of `database`, which
                            only sets what unqualified table names resolve
                            against at execution time.
                          type: string
                      required:
                        - type
                        - user
                        - region
                        - outputLocation
                  description: >-
                    The database's connection settings, of the connection's
                    type. Test them first with the client-database
                    test-connection endpoint: this one does not.
                  discriminator:
                    propertyName: type
              required:
                - name
                - config
            examples:
              example1:
                value:
                  apiKey: up_embed_************
                  organizationId: 123e4567-e89b-12d3-a456-426614174000
        required: true
      responses:
        '201':
          description: >-
            POST
            /v2/api/projects/:projectId/environments/:environment/connections/:sourceConnectionId/database
            Positive response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    type: object
                    properties:
                      connectionId:
                        type: string
                        description: The new database's connection id.
                      environment:
                        type: object
                        properties:
                          slug:
                            type: string
                            description: >-
                              The environment's identifier, immutable:
                              `production` or the slug it was created with.
                          name:
                            type: string
                            description: The environment's display name.
                          isDefault:
                            type: boolean
                            description: >-
                              True for production: built in, listed first,
                              cannot be renamed or deleted, and where every user
                              is unless they were put elsewhere.
                          connections:
                            type: array
                            items:
                              type: object
                              properties:
                                sourceConnectionId:
                                  type: string
                                  description: >-
                                    The production connection this mapping
                                    stands in for: the connection a workspace's
                                    versions target.
                                connectionId:
                                  type: string
                                  description: >-
                                    The connection that source means in this
                                    environment. May equal the source, for an
                                    environment that shares production's data.
                                updatedAt:
                                  type:
                                    - string
                                    - 'null'
                              required:
                                - sourceConnectionId
                                - connectionId
                                - updatedAt
                              additionalProperties: false
                            description: >-
                              The environment's connection mappings. Empty for
                              production, which runs every version on the
                              connection it targets.
                          userCount:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                            description: >-
                              How many project users belong to this environment,
                              the organization members' own users included.
                          organizationCount:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                            description: >-
                              How many project organizations belong to this
                              environment, the members' shadow organization
                              included.
                          memberUserCount:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                            description: >-
                              Of `userCount`, the users Upsolve keeps for each
                              organization member (one per member). They are
                              deleted with the environment, so they do not keep
                              it from being deleted.
                          memberOrganizationCount:
                            type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                            description: >-
                              Of `organizationCount`, the shadow organization
                              holding the members' users. Deleted with the
                              environment.
                          createdAt:
                            type:
                              - string
                              - 'null'
                        required:
                          - slug
                          - name
                          - isDefault
                          - connections
                          - userCount
                          - organizationCount
                          - memberUserCount
                          - memberOrganizationCount
                          - createdAt
                        additionalProperties: false
                    required:
                      - connectionId
                      - environment
                    additionalProperties: false
                required:
                  - status
                  - data
                additionalProperties: false
        '400':
          description: >-
            POST
            /v2/api/projects/:projectId/environments/:environment/connections/:sourceConnectionId/database
            Negative response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                    required:
                      - message
                    additionalProperties: false
                required:
                  - status
                  - error
                additionalProperties: false
      security:
        - APIKEY_1: []
components:
  securitySchemes:
    APIKEY_1:
      type: apiKey
      in: query
      name: apiKey
      x-in-actual: body
      description: apiKey MUST be supplied within the request body instead of query

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.