api reference

Snippets

Reusable SQL fragments, shared org-wide, expanded by trigger text in the query editor.

GET/api/query_snippets

List every snippet in the org.

Response

[
  {
    "id": 6,
    "trigger": "date_trunc_week",
    "description": "Truncate a timestamp column to the week",
    "snippet": "date_trunc('week', ${1:column})",
    "user_id": 12,
    "created_at": "2026-06-01T00:00:00Z",
    "updated_at": "2026-06-01T00:00:00Z"
  }
]

POST/api/query_snippets

Create a snippet.

Request

{
  "trigger": "date_trunc_week",
  "description": "Truncate a timestamp column to the week",
  "snippet": "date_trunc('week', ${1:column})"
}

POST/api/query_snippets/{id}

Update a snippet's trigger, description, or body. Every field is optional — only what's supplied changes.

Request

{ "snippet": "date_trunc('month', ${1:column})" }

DELETE/api/query_snippets/{id}

Delete a snippet. Returns 204.