Skip to main content
Authorization
string
required
Bearer token obtained from the authenticate endpoint.
query_id
string
required
Unique identifier of the saved query to retrieve.

Response

id
string
required
Unique identifier for the saved query.
organization_id
string
required
Organization the query belongs to.
title
string
required
Display title for the query.
query
string
required
The natural language query text.
sql
string
Optional raw SQL associated with the query.
last_updated_by
string
required
Member ID of the user who last modified this query.
last_updated_by_name
string
Display name of the user who last modified this query.
created_at
string
required
ISO 8601 timestamp when the query was created.
updated_at
string
required
ISO 8601 timestamp when the query was last modified.
curl -X GET https://api.trellis.sh/v1/queries/sq_001 \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "id": "sq_001",
  "organization_id": "org_abc123",
  "title": "Monthly Revenue",
  "query": "Show me total revenue by month for 2025",
  "sql": "SELECT DATE_TRUNC('month', created_at) as month, SUM(amount) as revenue FROM orders WHERE YEAR(created_at) = 2025 GROUP BY 1",
  "last_updated_by": "member_xyz789",
  "last_updated_by_name": "John Doe",
  "created_at": "2025-11-01T10:00:00Z",
  "updated_at": "2025-12-01T15:30:00Z"
}