---
title: "Execute SQL query"
method: POST
path: "/orchestration/query"
tags: ["Orchestration - Query"]
---

# Execute SQL query

`POST /orchestration/query`

Execute a read-only SQL query against orchestration ClickHouse tables (spans, runs, batches, records).

## Request body

- object — Request body schema.
  - `query` string, required — A read-only SELECT statement. Available tables: logs, runs, batches, records. Results are automatically scoped to the authenticated workspace Example: "SELECT status, count() FROM runs GROUP BY status"

## Response `200`

Successful response

- object
  - `rows` object[], required — Result rows.

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `404` — Not found
- `500` — Internal server error

---

[API](https://skmtc.net/getcargo/apis/cargo-api.md) · [All operations](https://skmtc.net/getcargo/apis/cargo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getcargo/cargo-api/revisions/1d5a19e01d83/schema)
