> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Connection

> Creates a new ClickHouse connection



## OpenAPI

````yaml https://raw.githubusercontent.com/hyperdxio/hyperdx/refs/heads/main/packages/api/openapi.json post /api/v2/connections
openapi: 3.0.0
info:
  title: HyperDX External API
  description: API for managing HyperDX alerts and dashboards
  version: 2.0.0
servers:
  - url: /
    description: Your HyperDX instance (http://<host>:<port>)
security:
  - BearerAuth: []
tags:
  - name: Dashboards
    description: Endpoints for managing dashboards and their visualizations
  - name: Alerts
    description: Endpoints for managing monitoring alerts
  - name: Charts
    description: Endpoints for querying chart data
  - name: Connections
    description: Endpoints for managing ClickHouse connections
  - name: Sources
    description: Endpoints for managing data sources
  - name: Webhooks
    description: Endpoints for managing webhooks
  - name: Search
    description: Endpoints for querying raw data from log and trace sources
paths:
  /api/v2/connections:
    post:
      tags:
        - Connections
      summary: Create Connection
      description: Creates a new ClickHouse connection
      operationId: createConnection
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnectionRequest'
      responses:
        '200':
          description: Successfully created connection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponseEnvelope'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: 'Body validation failed: name: Required'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Unauthorized access. API key is missing or invalid.
components:
  schemas:
    CreateConnectionRequest:
      type: object
      required:
        - name
        - host
        - username
      properties:
        name:
          type: string
          description: Display name for the connection.
          example: Production ClickHouse
        host:
          type: string
          description: ClickHouse HTTP endpoint URL.
          example: https://clickhouse.example.com:8443
        username:
          type: string
          description: ClickHouse username.
          example: default
        password:
          type: string
          writeOnly: true
          description: ClickHouse password. Never returned by the API.
          example: my-secret-password
        hyperdxSettingPrefix:
          type: string
          description: >-
            Optional prefix for HyperDX-specific ClickHouse settings. Must only
            contain alphanumeric characters and underscores.
          nullable: true
          example: hyperdx_
        isPrometheusEndpoint:
          type: boolean
          description: >-
            Optional. When true, `host` is treated as a Prometheus-compatible
            API endpoint (e.g. Prometheus or Thanos) and PromQL queries are
            proxied to it. When false or omitted, `host` is a ClickHouse HTTP
            endpoint.
          example: false
    ConnectionResponseEnvelope:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Connection'
          description: The connection object.
    Error:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message.
          example: 'NOT_FOUND: Alert not found'
    Connection:
      type: object
      required:
        - id
        - name
        - host
        - username
      properties:
        id:
          type: string
          description: Unique connection ID.
          example: 507f1f77bcf86cd799439012
        name:
          type: string
          description: Display name for the connection.
          example: Production ClickHouse
        host:
          type: string
          description: ClickHouse HTTP endpoint URL.
          example: https://clickhouse.example.com:8443
        username:
          type: string
          description: ClickHouse username.
          example: default
        hyperdxSettingPrefix:
          type: string
          description: >-
            Optional prefix for HyperDX-specific ClickHouse settings. Must only
            contain alphanumeric characters and underscores.
          nullable: true
          example: hyperdx_
        isPrometheusEndpoint:
          type: boolean
          description: >-
            Optional. When true, `host` is treated as a Prometheus-compatible
            API endpoint (e.g. Prometheus or Thanos) and PromQL queries are
            proxied to it. When false or omitted, `host` is a ClickHouse HTTP
            endpoint.
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
          example: '2025-01-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          example: '2025-06-15T10:30:00.000Z'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````