---
title: "Get SQL Query"
method: GET
path: "/sql/{sqlID}"
tags: ["SQL Queries"]
---

# Get SQL Query

`GET /sql/{sqlID}`

## Request

- Base URL: `https://api.us-e1.tago.io`
- URL: `https://api.us-e1.tago.io/sql/{sqlID}`
- Auth: API key in header `Profile-Token`
- TypeScript: <https://skmtc.dev/tago/apis/tagoio-api/docs/sql/:sqlID/get.ts> (a function with typed inputs; its response is checked against the schema)

Fetch one saved query by id. A saved query that belongs to another profile is invisible (404, never 403).

## Response `200`

The saved query.

- object
  - `status` boolean
  - `result` object
    - `id` string
    - `name` string
    - `description` string
    - `query` string
    - `params` object[]
      - `key` string
      - `value` string
    - `cache_enabled` boolean
    - `cache_ttl_seconds` integer
    - `rate_limit_rpm` integer
    - `active` boolean
    - `tags` object[]
      - `key` string
      - `value` string
    - `session_context` boolean: True when the query uses a session function (`session_user_id`, `session_user_tag`) and so resolves per executing user. Derived from the query text; never accepted in a request body.
    - `version` integer
    - `cache_version` integer
    - `created_at` string
    - `updated_at` string

## Other responses

- `404`: Saved query not found (or not owned by your profile).

## Changes

- **2026-11-07** `1a281f04cdab`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/tago/apis/tagoio-api/changes/sql/:sqlID/get.md)

---

[API](https://skmtc.dev/tago/apis/tagoio-api.md) - [All operations](https://skmtc.dev/tago/apis/tagoio-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tago/apis/tagoio-api/revisions/1a281f04cdab?raw)
