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

# Get Sql Schema

> Return the curated tables and columns available to public SQL.

Read from the same contract the validator and the rewriter derive from, so
what this advertises and what a query may reference cannot drift apart.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/public/sql/schema
openapi: 3.1.0
info:
  title: TraceRoot Public API
  version: 0.1.0
servers:
  - description: TraceRoot Cloud
    url: https://app.traceroot.ai
  - description: Self-hosted
    url: '{baseUrl}'
    variables:
      baseUrl:
        default: http://localhost:8000
        description: Your TraceRoot backend URL
security: []
paths:
  /api/v1/public/sql/schema:
    get:
      tags:
        - SQL
      summary: Get Sql Schema
      description: >-
        Return the curated tables and columns available to public SQL.


        Read from the same contract the validator and the rewriter derive from,
        so

        what this advertises and what a query may reference cannot drift apart.
      operationId: get_sql_schema
      parameters:
        - description: >-
            Target project for the request. Required when authenticating with a
            user session token (a user credential is only meaningful scoped to a
            project); for an API key it is optional and, if given, must match
            the key's project.
          in: query
          name: project_id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Target project for the request. Required when authenticating with
              a user session token (a user credential is only meaningful scoped
              to a project); for an API key it is optional and, if given, must
              match the key's project.
            title: Project Id
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SqlSchemaResponse'
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The credential names no project
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication failed
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The credential cannot access this project
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Validation error
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Rate limit exceeded
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication service unavailable
      security:
        - BearerAuth: []
components:
  schemas:
    SqlSchemaResponse:
      description: The curated analytical schema, which is all a caller can query.
      properties:
        tables:
          items:
            $ref: '#/components/schemas/SqlSchemaTable'
          title: Tables
          type: array
      required:
        - tables
      title: SqlSchemaResponse
      type: object
    ErrorResponse:
      description: >-
        The canonical public error envelope (matches the gateway's normalized
        shape).
      properties:
        detail:
          title: Detail
          type: string
      required:
        - detail
      title: ErrorResponse
      type: object
    SqlSchemaTable:
      description: A logical table the gateway exposes.
      properties:
        columns:
          items:
            $ref: '#/components/schemas/SqlSchemaColumn'
          title: Columns
          type: array
        name:
          title: Name
          type: string
      required:
        - name
        - columns
      title: SqlSchemaTable
      type: object
    SqlSchemaColumn:
      description: A curated column a caller may select.
      properties:
        name:
          title: Name
          type: string
        type:
          title: Type
          type: string
      required:
        - name
        - type
      title: SqlSchemaColumn
      type: object
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.