Browse the API reference

Execute SQL Statement

post/v1/graphs/{graph_id}/query/sql

Part 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-Key header.
  • Bearer token in the Authorization header.

Path parameters

NameTypeDescription
graph_idrequiredstringGraph Id

Request body

Required, application/json.

FieldTypeDescription
sqlrequiredstring

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.

parametersoptionalany[] | 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
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

FieldTypeDescription
columnsrequiredstring[]

Column names

rowsrequiredany[][]

Query results

row_countrequiredinteger

Number of rows returned

execution_time_msrequirednumber

Query execution time

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