> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coval.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the SQL metric schema

> Return the materialized frame tables, their columns, and the sample rows a draft SQL
metric query (`POST /v1/metrics/sql:test`) runs against. The schema is derived from the
global frame materializers, so it is org-agnostic and identical for every caller.




## OpenAPI

````yaml /api-reference/v1/metrics-v1.yaml get /metrics/sql-schema
openapi: 3.0.3
info:
  title: Coval Metrics API
  version: 1.0.0
  description: |
    Manage custom evaluation metrics for agent testing and monitoring.
  contact:
    name: Coval API Support
    email: support@coval.dev
    url: https://docs.coval.ai
  license:
    name: Proprietary
    url: https://coval.dev/terms
servers:
  - url: https://api.coval.dev/v1
    description: Production API
security:
  - ApiKeyAuth: []
tags:
  - name: Metrics
    description: CRUD operations for custom evaluation metrics
paths:
  /metrics/sql-schema:
    get:
      tags:
        - Metrics
      summary: Get the SQL metric schema
      description: >
        Return the materialized frame tables, their columns, and the sample rows
        a draft SQL

        metric query (`POST /v1/metrics/sql:test`) runs against. The schema is
        derived from the

        global frame materializers, so it is org-agnostic and identical for
        every caller.
      operationId: getSqlMetricSchema
      responses:
        '200':
          description: The SQL metric materialization schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimulationDataFramesSchemaResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    SimulationDataFramesSchemaResponse:
      type: object
      required:
        - tables
      properties:
        tables:
          type: array
          items:
            $ref: '#/components/schemas/SchemaTableResource'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - INVALID_ARGUMENT
                - UNAUTHENTICATED
                - PERMISSION_DENIED
                - NOT_FOUND
                - ALREADY_EXISTS
                - INTERNAL
            message:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    nullable: true
                  description:
                    type: string
    SchemaTableResource:
      type: object
      required:
        - name
        - columns
      properties:
        name:
          type: string
        columns:
          type: array
          items:
            $ref: '#/components/schemas/SchemaColumnResource'
        sample_rows:
          type: array
          description: Example rows of this table in the shared sample artifact.
          items:
            type: object
            additionalProperties: true
    SchemaColumnResource:
      type: object
      required:
        - name
        - sql_type
      properties:
        name:
          type: string
        sql_type:
          type: string
        enum:
          allOf:
            - $ref: '#/components/schemas/ColumnEnumResource'
          nullable: true
    ColumnEnumResource:
      type: object
      required:
        - name
        - values
      properties:
        name:
          type: string
          description: The enum type a column's values are drawn from.
        values:
          type: array
          items:
            type: string
  responses:
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHENTICATED
              message: Authentication failed
              details:
                - field: X-API-Key
                  description: Invalid or missing API key
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INTERNAL
              message: Internal server error
    ServiceUnavailable:
      description: Service temporarily unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INTERNAL
              message: Service temporarily unavailable
              details:
                - description: Database routing is temporarily unavailable. Please retry.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication

````