---
title: "Get relevant schema for an intent"
method: GET
path: "/schema/context"
tags: ["Schema"]
---

# Get relevant schema for an intent

`GET /schema/context`

## Request

- Base URL: `https://saturnsql.com/api`
- URL: `https://saturnsql.com/api/schema/context`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Returns only the slice of schema relevant to a stated goal — ideal for keeping an AI agent's context small on large databases. Feed the result straight into a SQL-generation prompt. Available to API keys with the `read` scope.

## Query parameters

- `connection_id` string, required
- `intent` string
- `tables` string
- `current_sql` string

## Response `200`

Relevant schema

- object
  - `connection_id` string
  - `schema` Table[]
    - `name` string, required
    - `columns` Column[], required
      - `name` string, required
      - `type` string, required
      - `nullable` boolean, required
      - `default` string, nullable
      - `isPrimaryKey` boolean
      - `isForeignKey` boolean
  - `context_id` string

## Other responses

- `400`: connection_id is required
- `401`: Bad or missing credentials
- `404`: Connection not found

---

[API](https://skmtc.dev/saturnsql/apis/saturnsql-api.md) · [All operations](https://skmtc.dev/saturnsql/apis/saturnsql-api/llms.txt) · [OpenAPI document](https://skmtc.dev/saturnsql/apis/saturnsql-api/revisions/90a3e54ad115?raw)
