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

# Assign a connection to a product

> Use this endpoint to assign an unassigned connection to a product. Provide the target product through the `X-Product-Name` header. This is a one-time, irreversible operation: once a connection is assigned to a product it cannot be reassigned. Use the [List unassigned connections](/en/reference/reporter/connections/list-unassigned-connections) endpoint to find connections that still need a product.



## OpenAPI

````yaml en/openapi/v3-current/connections.yaml post /v1/management/connections/{id}/assign
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}/assign:
    post:
      tags:
        - Database Connections
      summary: Assign a connection to a product
      description: >-
        Use this endpoint to assign an unassigned connection to a product.
        Provide the target product through the `X-Product-Name` header. This is
        a one-time, irreversible operation: once a connection is assigned to a
        product it cannot be reassigned. Use the [List unassigned
        connections](/en/reference/reporter/connections/list-unassigned-connections)
        endpoint to find connections that still need a product.
      parameters:
        - $ref: '#/components/parameters/ConnectionId'
        - $ref: '#/components/parameters/Authorization'
        - name: X-Product-Name
          in: header
          description: >-
            The product name to assign to this connection. Must contain only
            alphanumeric characters, underscores, and hyphens (max 100
            characters). The value is normalized to lowercase.
          required: true
          schema:
            type: string
            maxLength: 100
            pattern: ^[a-zA-Z0-9_-]+$
            example: my-product
      responses:
        '200':
          description: The connection after it was assigned to the product.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
              example:
                id: 019996b8-f3d1-7d2b-a192-6e91464d82fc
                configName: legacy-transactional-db
                productName: my-product
                type: POSTGRESQL
                host: postgres.cliente.com.br
                port: 5432
                databaseName: transaction
                userName: user_legacy_read
                schema: public
                ssl:
                  mode: require
                metadata: {}
                createdAt: '2025-09-25T10:30:00Z'
                updatedAt: '2025-09-25T10:35:00Z'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0402:
                  $ref: '#/components/examples/Error0402'
                Error0404:
                  $ref: '#/components/examples/Error0404'
        '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:
                Error1015:
                  $ref: '#/components/examples/Error1015'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0002:
                  $ref: '#/components/examples/Error0002'
      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:
    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/SSLResponse'
        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.
    SSLResponse:
      type: object
      description: >-
        SSL configuration returned in connection responses. Only the SSL `mode`
        is exposed; certificate material (`ca`, `cert`, `key`) is never
        returned.
      properties:
        mode:
          type: string
          description: SSL connection mode configured for this connection.
          enum:
            - disable
            - require
            - verify-ca
            - verify-full
          example: require
    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:
    Error0402:
      summary: Missing Fields in Request
      value:
        code: FET-0402
        title: Missing Fields in Request
        message: >-
          Your request is missing one or more required fields. Please refer to
          the documentation to ensure all necessary fields are included in your
          request.
    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.
    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.
    Error1015:
      summary: Connection Already Assigned
      value:
        code: FET-1015
        title: Connection Already Assigned
        message: >-
          The connection is already assigned to a product and cannot be
          reassigned.
    Error0002:
      summary: Internal Server Error
      value:
        code: FET-0002
        title: Internal Server Error
        message: >-
          The server encountered an unexpected error. Please try again later or
          contact support.

````