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

# Retrieve connection schema

> Use this endpoint to retrieve the database schema of a connection: the tables available in the connected database and the fields within each table. Use it to discover the structure of a data source before mapping its tables and fields in a data extraction job.



## OpenAPI

````yaml en/openapi/v3-current/connections.yaml get /v1/management/connections/{id}/schema
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}/schema:
    get:
      tags:
        - Database Connections
      summary: Retrieve connection schema
      description: >-
        Use this endpoint to retrieve the database schema of a connection: the
        tables available in the connected database and the fields within each
        table. Use it to discover the structure of a data source before mapping
        its tables and fields in a data extraction job.
      parameters:
        - $ref: '#/components/parameters/ConnectionId'
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: >-
            The schema of the connected database, listing its tables and their
            fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionSchemaResponse'
              example:
                id: 019996b2-b6b1-7401-8c0b-f1ad397080eb
                configName: Midaz - Banco Transacional
                databaseName: transaction
                type: POSTGRESQL
                tables:
                  - name: organization
                    fields:
                      - id
                      - legal_name
                      - status
                      - created_at
                  - name: ledger
                    fields:
                      - id
                      - organization_id
                      - name
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0404:
                  $ref: '#/components/examples/Error0404'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error1001:
                  $ref: '#/components/examples/Error1001'
        '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:
    ConnectionSchemaResponse:
      type: object
      description: >-
        The database schema of a connection: identifying details of the
        connection plus the tables and fields discovered in the connected
        database.
      required:
        - id
        - configName
        - databaseName
        - type
        - tables
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the connection (UUID format).
          example: 019996b2-b6b1-7401-8c0b-f1ad397080eb
        configName:
          type: string
          description: The unique configuration name of the connection.
          example: Midaz - Banco Transacional
        databaseName:
          type: string
          description: Name of the database the schema was read from.
          example: transaction
        type:
          type: string
          description: Database engine type of the connection.
          enum:
            - ORACLE
            - SQL_SERVER
            - POSTGRESQL
            - MONGODB
            - MYSQL
          example: POSTGRESQL
        tables:
          type: array
          description: >-
            The tables available in the connected database, each with its
            fields.
          items:
            $ref: '#/components/schemas/TableDetails'
    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.
    TableDetails:
      type: object
      description: A table in the connected database and the fields it contains.
      required:
        - name
        - fields
      properties:
        name:
          type: string
          description: The table name.
          example: organization
        fields:
          type: array
          description: The field (column) names in this table.
          items:
            type: string
          example:
            - id
            - legal_name
            - status
  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.
    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.
    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.

````