> ## 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.

# Update a connection

> Use this endpoint to apply a partial update to a connection. Returns `409 Conflict` if there is any active job using this connection.



## OpenAPI

````yaml /en/openapi/v3-current/connections.yaml patch /v1/management/connections/{id}
openapi: 3.1.0
info:
  title: Database Connections
  description: >-
    The database connections API provides endpoints for managing the database
    connections used by Reporter. It allows you to create, list, update, delete,
    and test database connections, as well as validate schemas against
    configured data sources.
  version: 1.0.0
servers:
  - url: https://reporter.sandbox.lerian.net
security: []
tags:
  - name: Database Connections
    description: Endpoints for managing database connections used by Reporter.
paths:
  /v1/management/connections/{id}:
    patch:
      tags:
        - Database Connections
      summary: Update a connection
      description: >-
        Use this endpoint to apply a partial update to a connection. Returns
        `409 Conflict` if there is any active job using this connection.
      parameters:
        - $ref: '#/components/parameters/ConnectionId'
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConnectionRequest'
            example:
              configName: production-db-updated
              host: new-db.example.com
              port: 5433
              schema: analytics
              userName: new_dbuser
              password: new_secretpassword
              metadata:
                environment: production
                team: data-platform
      responses:
        '200':
          description: Indicates that the connection was successfully updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
              example:
                id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                configName: production-db-updated
                productName: my-product
                type: POSTGRESQL
                host: new-db.example.com
                port: 5433
                databaseName: mydatabase
                userName: new_dbuser
                schema: analytics
                ssl:
                  mode: require
                metadata:
                  environment: production
                  team: data-platform
                createdAt: '2024-01-15T10:30:00Z'
                updatedAt: '2024-01-16T14:20:00Z'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0404:
                  $ref: '#/components/examples/Error0404'
                Error0410:
                  $ref: '#/components/examples/Error0410'
                Error0412:
                  $ref: '#/components/examples/Error0412'
                Error0411:
                  $ref: '#/components/examples/Error0411'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error1001:
                  $ref: '#/components/examples/Error1001'
        '409':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error1002:
                  $ref: '#/components/examples/Error1002'
                Error1021:
                  $ref: '#/components/examples/Error1021'
      security: []
components:
  parameters:
    ConnectionId:
      name: id
      in: path
      description: Unique identifier of the connection (UUID format).
      required: true
      schema:
        type: string
        format: uuid
        example: 019996b8-f3d1-7d2b-a192-6e91464d82fc
    Authorization:
      name: Authorization
      in: header
      description: >-
        The authorization token in the `Bearer <token>` format.


        **Important:** This header is required if your environment has Access
        Manager enabled. For more information, refer to the [Access
        Manager](/en/platform/access-manager/access-manager) documentation.
      required: false
      schema:
        type: string
        example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
  schemas:
    UpdateConnectionRequest:
      type: object
      description: >-
        Request body for updating an existing database connection. All fields
        are optional.
      properties:
        configName:
          type: string
          description: >-
            Unique identifier name for this connection configuration. Must be
            between 3 and 100 characters.
          minLength: 3
          maxLength: 100
          example: production-db-updated
        type:
          type: string
          description: Database engine type.
          enum:
            - ORACLE
            - SQL_SERVER
            - POSTGRESQL
            - MONGODB
            - MYSQL
          example: POSTGRESQL
        host:
          type: string
          description: Hostname or IP address of the database server.
          example: new-db.example.com
        port:
          type: integer
          description: Network port number for the database connection.
          minimum: 1
          maximum: 65535
          example: 5433
        databaseName:
          type: string
          description: Name of the database to connect to on the target server.
          example: mydatabase
        userName:
          type: string
          description: Username credential for database authentication.
          example: new_dbuser
        password:
          type: string
          description: >-
            Password credential for database authentication. This value is
            encrypted upon storage.
          format: password
          example: new_secretpassword
        schema:
          type: string
          description: >-
            Database schema name (for example, `public`, `analytics`). Useful
            for PostgreSQL databases with custom schemas.
          example: analytics
        ssl:
          $ref: '#/components/schemas/SSL'
        metadata:
          $ref: '#/components/schemas/Metadata'
    ConnectionResponse:
      type: object
      description: Response object containing connection details.
      required:
        - id
        - configName
        - type
        - host
        - port
        - databaseName
        - userName
        - createdAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the connection (UUID format).
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        productName:
          type: string
          description: >-
            The product name associated with this connection. May be empty if
            the connection has not been assigned to a product.
          example: my-product
        configName:
          type: string
          description: Unique identifier name for this connection configuration.
          example: production-db
        type:
          type: string
          description: >-
            Database engine type. Supported values: `ORACLE`, `SQL_SERVER`,
            `POSTGRESQL`, `MONGODB`, `MYSQL`. Note that the data source `type`
            field in the [List Data
            Sources](/en/reference/reporter/list-data-sources) endpoint returns
            lowercase identifiers (`postgresql`, `mongodb`).
          enum:
            - ORACLE
            - SQL_SERVER
            - POSTGRESQL
            - MONGODB
            - MYSQL
          example: POSTGRESQL
        host:
          type: string
          description: Hostname or IP address of the database server.
          example: db.example.com
        port:
          type: integer
          description: Network port number for the database connection.
          example: 5432
        databaseName:
          type: string
          description: Name of the database to connect to on the target server.
          example: mydatabase
        userName:
          type: string
          description: Username credential for database authentication.
          example: dbuser
        schema:
          type: string
          description: Database schema name, when set.
          example: public
        ssl:
          $ref: '#/components/schemas/SSL'
        metadata:
          $ref: '#/components/schemas/Metadata'
        createdAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp indicating when the connection was created.
          example: '2024-01-15T10:30:00Z'
        updatedAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp indicating when the connection was last updated.
          example: '2024-01-15T10:30:00Z'
    Error:
      type: object
      description: >-
        Response message error. Error codes use the `FET` prefix to identify
        issues related to the database connections API.
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: A unique, stable identifier for the error (prefixed with `FET`).
          example: FET-0001
        title:
          type: string
          description: A brief summary of the issue.
          example: Missing required fields
        message:
          type: string
          description: Detailed guidance for resolving the error.
          example: >-
            One or more required fields are missing. Please ensure all required
            fields like configName, host, port, userName, and password are
            included.
    SSL:
      type: object
      description: SSL configuration object containing certificate and security options.
      required:
        - mode
      properties:
        mode:
          type: string
          description: >-
            SSL connection mode. Supported values: - `disable`: No SSL
            connection - `require`: SSL required but no certificate verification
            - `verify-ca`: SSL with CA certificate verification - `verify-full`:
            SSL with full certificate verification
          enum:
            - disable
            - require
            - verify-ca
            - verify-full
          example: require
        ca:
          type: string
          description: >-
            Certificate Authority (CA) certificate for server verification (PEM
            format).
          example: |
            -----BEGIN CERTIFICATE-----
            MIIDdzCCAl+gAwIBAgIEbV...
            -----END CERTIFICATE-----
        cert:
          type: string
          description: Client certificate for SSL mutual authentication (PEM format).
        key:
          type: string
          description: Private key for the client certificate (PEM format).
    Metadata:
      type: object
      additionalProperties:
        type: string
        maxLength: 2000
      description: >-
        An object containing key-value pairs for storing additional
        connection-related information. Keys (max 100 characters) and values
        (max 2000 characters) must be strings. Nested objects are not allowed.
      example:
        environment: production
        team: data-engineering
  examples:
    Error0404:
      summary: Invalid Path Parameter
      value:
        code: FET-0404
        title: Invalid Path Parameter
        message: >-
          Path parameters is in an incorrect format. Please check the following
          parameter 'id' and ensure they meet the required format before trying
          again.
    Error0410:
      summary: Invalid Metadata Nesting
      value:
        code: FET-0410
        title: Invalid Metadata Nesting
        message: >-
          The metadata object cannot contain nested values. Please ensure that
          the value is not nested and try again.
    Error0412:
      summary: Metadata Key Length Exceeded
      value:
        code: FET-0412
        title: Metadata Key Length Exceeded
        message: >-
          The metadata key exceeds the maximum allowed length of 100 characters.
          Please use a shorter key.
    Error0411:
      summary: Metadata Value Length Exceeded
      value:
        code: FET-0411
        title: Metadata Value Length Exceeded
        message: >-
          The metadata value exceeds the maximum allowed length of 2000
          characters. Please use a shorter value.
    Error1001:
      summary: Entity Not Found
      value:
        code: FET-1001
        title: Entity Not Found
        message: >-
          It was not possible to find the connection entity during the requested
          flow. Please review the data provided in the request.
    Error1002:
      summary: Conflict
      value:
        code: FET-1002
        title: Conflict
        message: >-
          An entity of type connection with the same unique attributes already
          exists. Please use different values to avoid conflicts and review the
          data provided in the request.
    Error1021:
      summary: Job In Progress
      value:
        code: FET-1021
        title: Job In Progress
        message: >-
          The operation cannot be completed because there are active jobs for
          this connection.

````