Skip to main content
Authorization
string
required
Bearer token obtained from the authenticate endpoint.
title
string
required
Display title for the query.
query
string
required
The natural language query text to save.
sql
string
Optional raw SQL to associate with the query.

Response

Returns the created saved query object.
id
string
required
Unique identifier for the newly created 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
Raw SQL associated with the query, if provided.
last_updated_by
string
required
Member ID of the user who created 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 created.
curl -X POST https://api.trellis.sh/v1/queries \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Top Customers",
    "query": "Who are our top 10 customers by total spend?"
  }'
{
  "id": "sq_002",
  "organization_id": "org_abc123",
  "title": "Top Customers",
  "query": "Who are our top 10 customers by total spend?",
  "sql": null,
  "last_updated_by": "member_xyz789",
  "created_at": "2025-01-11T10:00:00Z",
  "updated_at": "2025-01-11T10:00:00Z"
}