---
title: "Run a read-only SQL query over session transcripts."
method: POST
path: "/v0/sql"
tags: ["Workspaces"]
---

# Run a read-only SQL query over session transcripts.

`POST /v0/sql`

## Request

- Base URL: `https://api.conductor.build` (the document declares no server; this is the origin it was published from)
- URL: `https://api.conductor.build/v0/sql`
- Auth: HTTP bearer

Runs a single read-only SQL SELECT statement over session transcripts and returns the matching rows. The view covers only the workspaces in your organization that you can access: those shared with the whole organization plus any private workspaces shared with you.

Queries may ONLY read from the view session_transcripts_view; every other table, view, and function is off-limits. Query it like a table, e.g. SELECT ... FROM session_transcripts_view. Its columns are:

- session_id (text): ID of the session (chat).
- workspace_id (text): ID of the workspace the session belongs to.
- transcript (text): concise plain-text transcript of the session's conversation.
- session_title (text, nullable): title of the session.
- agent_type (text, nullable): agent that ran the session, e.g. 'claude' or 'codex'.
- model (text, nullable): model the session used.
- workspace_name (text, nullable): display name of the workspace.
- workspace_state (text): workspace lifecycle state, e.g. 'ready' or 'archived'.
- repo_url (text): git remote URL of the workspace's repository.
- session_created_at (timestamptz): when the session was created.
- transcript_updated_at (timestamptz): when the transcript last changed.
- workspace_created_at (timestamptz): when the workspace was created.
- workspace_creator_id (text, nullable): ID of the user who created the workspace; matches the user id from GET /me for scoping "my" queries.
- workspace_creator_name (text, nullable): display name of the workspace creator (their email when no name is set).

Limits: at most 500 rows are returned (the response sets truncated: true when the query matched more), statements time out after 5 seconds, and the query text may be at most 10000 characters. The statement must be a single query: semicolon-chained statements, writes, U& Unicode-escape syntax, and queries containing the text set_config anywhere (even inside a search string) are rejected. Errors come back as 400s carrying the Postgres error message.

Example queries:

- Search transcripts: SELECT session_id, session_title, workspace_name FROM session_transcripts_view WHERE transcript ILIKE '%database migration%' ORDER BY transcript_updated_at DESC LIMIT 20
- Recent sessions in live workspaces: SELECT session_title, workspace_name, transcript_updated_at FROM session_transcripts_view WHERE workspace_state = 'ready' ORDER BY transcript_updated_at DESC LIMIT 50

## Request body

- object
  - `query` string, required

## Response `200`

Default Response

- object
  - `rows` object[], required
  - `rowCount` number, required
  - `truncated` boolean, required

## Other responses

- `400`: Invalid request.
- `401`: Missing or invalid bearer token.
- `404`: Resource not found.
- `default`: Error response.

---

[API](https://skmtc.dev/conductor-build/apis/roundhouse-public-api.md) - [All operations](https://skmtc.dev/conductor-build/apis/roundhouse-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/conductor-build/apis/roundhouse-public-api/revisions/1f39c7f7f219?raw)
