Skip to content

Execute Sql

POST
/api/v1/execute

Execute raw SQL against a connected database and return results.

Supports both human and agent callers. Agent callers are subject to guardrail levels that restrict which statement types are allowed.

ExecuteSqlRequest
object
connection_id
required
Connection Id

UUID of the registered database connection.

string
sql
required
Sql

Raw SQL statement to execute.

string
caller
CallerType

Who is executing this query: ‘human’ (no guardrails) or ‘agent’ (guardrails apply).

string
default: human
Allowed values: human agent
guardrail
AgentGuardrail

Agent guardrail level. Only applies when caller=‘agent’. strict=SELECT only, moderate=SELECT+DML, permissive=all SQL.

string
default: strict
Allowed values: strict moderate permissive
row_limit
Row Limit

Maximum number of rows to return.

integer
default: 1000 >= 1 <= 10000
timeout_seconds
Timeout Seconds

Query execution timeout in seconds.

number
default: 30 >= 1 <= 120

Successful Response

ExecuteSqlResponse
object
success
required
Success

Whether the query executed successfully.

boolean
data
Any of:
ExecuteSqlData
object
columns
required
Columns

Column names from the result set.

Array<string>
rows
required
Rows

Result rows as arrays of values.

Array<Array>
row_count
required
Row Count

Number of rows returned.

integer
truncated
required
Truncated

True if results were capped by row_limit.

boolean
affected_rows
Any of:
integer
error
Any of:
ExecuteSqlError
object
code
required
Code

Error code (e.g., GUARDRAIL_VIOLATION, SQL_ERROR, TIMEOUT).

string
message
required
Message

Human-readable error message.

string

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object