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

# Create connection

> Creates a database connection for the product named by the X-Product-Name header.



## OpenAPI

````yaml en/openapi/v3-current/connections.yaml post /v1/management/connections
openapi: 3.1.0
info:
  contact:
    email: contact@lerian.studio
    name: Lerian
    url: https://github.com/LerianStudio/fetcher/discussions
  description: API documentation for the Fetcher Manager component
  license:
    identifier: Elastic-2.0
    name: Elastic License 2.0 (Source Available)
  title: Fetcher Manager API
  version: 1.0.0
servers: []
security:
  - BearerAuth: []
tags:
  - description: Database connection lifecycle and schema operations.
    name: Connections
  - description: Legacy connection assignment and migration operations.
    name: Migration
  - description: Data extraction job creation and status operations.
    name: Fetcher
paths:
  /v1/management/connections:
    post:
      tags:
        - Connections
      summary: Create connection
      description: >-
        Creates a database connection for the product named by the
        X-Product-Name header.
      operationId: create-connection
      parameters:
        - description: Product name used for connection isolation.
          in: header
          name: X-Product-Name
          required: true
          schema:
            examples:
              - midaz
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionInput'
        description: Connection settings and credentials.
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
          description: Created
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unauthorized
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Forbidden
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Conflict
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Internal Server Error
components:
  schemas:
    ConnectionInput:
      additionalProperties: false
      properties:
        configName:
          description: Unique configuration name used to reference this connection.
          examples:
            - production-db
          type: string
        databaseName:
          description: Database name to connect to.
          examples:
            - mydatabase
          type: string
        host:
          description: Database server hostname or IP address.
          examples:
            - db.example.com
          type: string
        metadata:
          additionalProperties: {}
          description: Optional application-defined connection metadata.
          examples:
            - environment: production
              region: us-east-1
          type: object
        password:
          description: Database authentication password.
          examples:
            - secretpassword
          type: string
        port:
          description: Database server TCP port.
          examples:
            - 5432
          format: int64
          type: integer
        schema:
          description: Optional default database schema.
          examples:
            - public
          type: string
        ssl:
          $ref: '#/components/schemas/SSLInput'
          description: Optional SSL/TLS connection settings.
          examples:
            - ca: certificate-authority
              mode: require
        type:
          description: Database engine type.
          examples:
            - POSTGRESQL
          type: string
        userName:
          description: Database authentication username.
          examples:
            - dbuser
          type: string
      required:
        - configName
        - type
        - host
        - port
        - databaseName
        - userName
        - password
      type: object
    ConnectionResponse:
      additionalProperties: false
      properties:
        configName:
          description: Configuration name used to reference the connection.
          examples:
            - production-db
          type: string
        createdAt:
          description: Timestamp when the connection was created.
          examples:
            - '2026-01-15T10:30:00Z'
          format: date-time
          type: string
        databaseName:
          description: Connected database name.
          examples:
            - mydatabase
          type: string
        host:
          description: Database server hostname or IP address.
          examples:
            - db.example.com
          type: string
        id:
          description: Unique connection identifier.
          examples:
            - 018f47a6-3e5f-7b9a-8c1d-2e3f4a5b6c7d
          type: string
        metadata:
          additionalProperties: {}
          description: Application-defined connection metadata.
          examples:
            - environment: production
              region: us-east-1
          type: object
        port:
          description: Database server TCP port.
          examples:
            - 5432
          format: int64
          type: integer
        productName:
          description: Product that owns the connection.
          examples:
            - midaz
          type: string
        schema:
          description: Default database schema, when configured.
          examples:
            - public
          type: string
        ssl:
          $ref: '#/components/schemas/SSLResponse'
          description: Configured SSL/TLS settings with secrets omitted.
          examples:
            - mode: require
        type:
          description: Database engine type.
          examples:
            - POSTGRESQL
          type: string
        updatedAt:
          description: Timestamp when the connection was last updated.
          examples:
            - '2026-01-16T14:45:00Z'
          format: date-time
          type: string
        userName:
          description: Database authentication username.
          examples:
            - dbuser
          type: string
      required:
        - id
        - configName
        - type
        - host
        - port
        - databaseName
        - userName
        - createdAt
        - updatedAt
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    SSLInput:
      additionalProperties: false
      properties:
        ca:
          description: PEM-encoded certificate authority used to verify the server.
          examples:
            - |-
              -----BEGIN CERTIFICATE-----
              ...
          type: string
        cert:
          description: Optional PEM-encoded client certificate.
          examples:
            - |-
              -----BEGIN CERTIFICATE-----
              ...
          type: string
        key:
          description: Optional PEM-encoded private key for the client certificate.
          examples:
            - |-
              -----BEGIN PRIVATE KEY-----
              ...
          type: string
        mode:
          description: Driver-specific SSL/TLS mode.
          examples:
            - require
          type: string
      required:
        - mode
        - ca
      type: object
    SSLResponse:
      additionalProperties: false
      properties:
        mode:
          description: Configured driver-specific SSL/TLS mode.
          examples:
            - require
          type: string
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http

````