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

# Validate schema

> Use this endpoint to validate that tables and fields referenced in the request exist in the configured data sources. This is useful for verifying schema mappings before creating data extraction jobs.

**Important:** The `mappedFields` object uses `configName` (the unique name you assigned to the connection) as the key -- not the connection UUID. This differs from other endpoints that use the `id` path parameter.



## OpenAPI

````yaml /en/openapi/v3-current/connections.yaml post /v1/management/connections/validate-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/validate-schema:
    post:
      tags:
        - Database Connections
      summary: Validate schema
      description: >-
        Use this endpoint to validate that tables and fields referenced in the
        request exist in the configured data sources. This is useful for
        verifying schema mappings before creating data extraction jobs.


        **Important:** The `mappedFields` object uses `configName` (the unique
        name you assigned to the connection) as the key -- not the connection
        UUID. This differs from other endpoints that use the `id` path
        parameter.
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateSchemaRequest'
            example:
              mappedFields:
                midaz_onboarding:
                  organization:
                    - id
                    - legal_name
                    - status
                    - created_at
                  ledger:
                    - id
                    - organization_id
                    - name
                midaz_transaction:
                  transaction:
                    - id
                    - ledger_id
                    - amount
                    - status
                  account:
                    - id
                    - name
                    - balance
      responses:
        '200':
          description: The result of the schema validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateSchemaResponse'
              examples:
                Success:
                  summary: All fields validated successfully
                  value:
                    status: success
                    message: All fields validated successfully
                    errors: []
                Failure:
                  summary: Schema validation found errors
                  value:
                    status: failure
                    message: Schema validation found errors
                    errors:
                      - dataSourceId: midaz_onboarding
                        table: organization
                        field: invalid_field
                        type: FIELD_NOT_FOUND
                      - dataSourceId: midaz_transaction
                        table: non_existent_table
                        field: ''
                        type: TABLE_NOT_FOUND
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0401:
                  $ref: '#/components/examples/Error0401'
                Error1020:
                  $ref: '#/components/examples/Error1020'
                Error1062:
                  $ref: '#/components/examples/Error1062'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0002:
                  $ref: '#/components/examples/Error0002'
      security: []
components:
  parameters:
    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:
    ValidateSchemaRequest:
      type: object
      description: >-
        Request body for validating schema mappings against configured data
        sources. Use `configName` (not the connection UUID) as the key in
        `mappedFields`.
      required:
        - mappedFields
      properties:
        mappedFields:
          type: object
          description: >-
            Object containing the field mapping configuration. The structure is:
            `{ configName: { tableName: [field1, field2, ...] } }`. Use the
            connection's `configName` as the top-level key.
          additionalProperties:
            type: object
            description: Tables and fields to validate for this data source.
            additionalProperties:
              type: array
              items:
                type: string
              description: List of field names to validate in this table.
          example:
            midaz_onboarding:
              organization:
                - id
                - legal_name
                - status
              ledger:
                - id
                - organization_id
                - name
    ValidateSchemaResponse:
      type: object
      description: Response object containing the result of schema validation.
      required:
        - status
        - message
        - errors
      properties:
        status:
          type: string
          description: >-
            The validation result status. Returns `success` when all fields are
            valid, or `failure` when validation errors are found.
          enum:
            - success
            - failure
          example: success
        message:
          type: string
          description: A human-readable summary of the validation result.
          example: All fields validated successfully
        errors:
          type: array
          description: >-
            A list of validation errors found during schema validation. Empty
            when status is `success`.
          items:
            $ref: '#/components/schemas/ValidationError'
    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.
    ValidationError:
      type: object
      description: Details of a validation error found during schema validation.
      required:
        - dataSourceId
        - type
      properties:
        dataSourceId:
          type: string
          description: >-
            The `configName` of the data source where the validation error
            occurred.
          example: midaz_onboarding
        table:
          type: string
          description: >-
            The name of the table that failed validation or contains the invalid
            field.
          example: organization
        field:
          type: string
          description: >-
            The name of the field that failed validation. Empty when the error
            is at the table level.
          example: invalid_field
        type:
          type: string
          description: >-
            The type of validation error. Possible values: - `TABLE_NOT_FOUND`:
            The specified table does not exist in the data source -
            `FIELD_NOT_FOUND`: The specified field does not exist in the table -
            `DATA_SOURCE_NOT_FOUND`: The specified data source configuration was
            not found - `DATA_SOURCE_DOWN`: The data source is unreachable or
            unavailable
          enum:
            - TABLE_NOT_FOUND
            - FIELD_NOT_FOUND
            - DATA_SOURCE_NOT_FOUND
            - DATA_SOURCE_DOWN
          example: FIELD_NOT_FOUND
  examples:
    Error0401:
      summary: Invalid Data Request
      value:
        code: FET-0401
        title: Invalid Data Request
        message: >-
          The request contains invalid data. Please check the request payload
          and try again.
    Error1020:
      summary: Invalid Mapped Fields
      value:
        code: FET-1020
        title: Invalid Mapped Fields
        message: >-
          The mappedFields configuration is invalid. Please check the structure
          and try again.
    Error1062:
      summary: Connection Config Not Found
      value:
        code: FET-1062
        title: Connection Config Not Found
        message: >-
          No connections configured for the referenced data source config names.
          Please verify the configName values used in mappedFields.
    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.

````