Execute SQL Statement
/v1/graphs/{graph_id}/query/sqlPart of Query.
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.
Authentication
Authenticate in any one of these ways — not all of them:
- API key in the
X-API-Keyheader. - Bearer token in the
Authorizationheader.
Path parameters
| Name | Type | Description |
|---|---|---|
graph_idrequired | string | Graph Id |
Request body
Required, application/json.
| Field | Type | Description |
|---|---|---|
sqlrequired | string | 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. |
parametersoptional | any[] | object | 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. |
Example request
curl -X POST "https://api.robosystems.ai/v1/graphs/{graph_id}/query/sql" \
-H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parameters": [
"Company",
100
],
"sql": "SELECT * FROM Entity WHERE entity_type = ? LIMIT ?"
}'Responses
200 Successful Response
| Field | Type | Description |
|---|---|---|
columnsrequired | string[] | Column names |
rowsrequired | any[][] | Query results |
row_countrequired | integer | Number of rows returned |
execution_time_msrequired | number | Query execution time |
| Status | Meaning |
|---|---|
| 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 |