curl -L -X POST 'https://flux.postacksolutions.com/api/developer/projects/{projectId}/servers/{serverId}/database/query' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"query": "SELECT * FROM end_users WHERE server_id = ? LIMIT 10",
"args": []
}'{
"columns": ["id", "server_id", "name", "email", "created_at"],
"rows": [
["user_123", "server_abc", "John Doe", "john@example.com", "2024-01-15T10:30:00Z"],
["user_456", "server_abc", "Jane Smith", "jane@example.com", "2024-01-15T11:00:00Z"]
],
"rowsAffected": 2,
"executionTime": 15,
"success": true
}Execute SQL Query
Execute SQL queries against your server's database. All queries are automatically scoped to the specified server for security.
{
"columns": ["id", "server_id", "name", "email", "created_at"],
"rows": [
["user_123", "server_abc", "John Doe", "john@example.com", "2024-01-15T10:30:00Z"],
["user_456", "server_abc", "Jane Smith", "jane@example.com", "2024-01-15T11:00:00Z"]
],
"rowsAffected": 2,
"executionTime": 15,
"success": true
}Authorizations
Path Parameters
Request Body
SQL query and parameters
The SQL query to execute. Only single statements are allowed (no semicolons). Maximum length: 10KB.
Security: All queries must include WHERE server_id = ? for server-scoped tables (end_users, conversations, messages, files).
Parameter Handling:
- SELECT queries: Do NOT include
server_idin theargsarray. The endpoint automatically adds the authenticated server ID. - UPDATE/DELETE queries: You can include
server_idinargs, but the endpoint will replace it with the authenticated server ID for security. - INSERT queries: Must include
server_idin the VALUES clause. Ensure correct parameter order inargs.
Optional array of query parameters for parameterized queries.
Important:
- SELECT: Use empty array
[]- server_id is added automatically - UPDATE/DELETE: Include your parameters (e.g., primary key), then server_id as last param (will be replaced with authenticated value)
- INSERT: Include all values in order, including server_id
Response
Successful query execution response
Array of column names from the query result
Array of rows, where each row is an array of values matching the columns order
Number of rows affected by the query (for INSERT, UPDATE, DELETE statements)
Query execution time in milliseconds
Whether the query executed successfully