---
title: "Execute SQL Statement"
method: POST
path: "/v1/graphs/{graph_id}/query/sql"
tags: ["Query"]
---

# Execute SQL Statement

`POST /v1/graphs/{graph_id}/query/sql`

## Request

- Base URL: `https://api.robosystems.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.robosystems.ai/v1/graphs/{graph_id}/query/sql`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

SQL over the graph's columnar tables (DuckDB) — a relational lens on the same graph-centric data, often ahead of the materialized graph. Use `?` placeholders with the `parameters` array to prevent injection. Read-only (SELECT only), 30s timeout, 10,000 row limit. Not available on shared repositories.

## Path parameters

- `graph_id` string, required

## Request body

- SqlStatementRequest
  - `sql` string, required: SQL query over the graph's columnar tables (DuckDB) — a relational lens on the same graph-centric data, often ahead of the materialized graph. Use ? placeholders or $param_name for dynamic values to prevent SQL injection.
  - `parameters` union: Query parameters for safe value substitution. ALWAYS use parameters instead of string concatenation. Pass a list for positional placeholders (`?` or `$1`) and an object for named ones (`$param_name`) — the two forms cannot be mixed in one statement.
    - unknown[]
      - unknown
    - object

## Response `200`

Successful Response

- SqlStatementResponse
  - `columns` string[], required: Column names
  - `rows` array[], required: Query results
    - unknown[]
      - unknown
  - `row_count` integer, required: Number of rows returned
  - `execution_time_ms` number, required: Query execution time

## Other responses

- `400`: Invalid request
- `401`: Authentication required
- `403`: Access denied
- `404`: Resource not found
- `408`: Query timeout
- `422`: Validation Error
- `429`: Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/robosystems/apis/robosystems-api.md) · [All operations](https://skmtc.dev/robosystems/apis/robosystems-api/llms.txt) · [OpenAPI document](https://skmtc.dev/robosystems/apis/robosystems-api/revisions/e661e2d5ca6a?raw)
