---
title: "Get Sql Schema"
method: GET
path: "/api/v1/public/sql/schema"
tags: ["SQL"]
---

# Get Sql Schema

`GET /api/v1/public/sql/schema`

## Request

- Base URL: `https://app.traceroot.ai`
- URL: `https://app.traceroot.ai/api/v1/public/sql/schema`
- Auth: HTTP bearer

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.

## Query parameters

- `project_id` string, nullable: 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.

## Response `200`

Successful Response

- SqlSchemaResponse: The curated analytical schema, which is all a caller can query.
  - `tables` SqlSchemaTable[], required
    - `columns` SqlSchemaColumn[], required
      - `name` string, required
      - `type` string, required
    - `name` string, required

## Other responses

- `400`: The credential names no project
- `401`: Authentication failed
- `403`: The credential cannot access this project
- `422`: Validation error
- `429`: Rate limit exceeded
- `503`: Authentication service unavailable

---

[API](https://skmtc.dev/traceroot/apis/traceroot-public-api.md) - [All operations](https://skmtc.dev/traceroot/apis/traceroot-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/traceroot/apis/traceroot-public-api/revisions/ce6aef96c0d6?raw)
