psql, genuinely needs one.
Query the API securely
Send the request from your server, worker, or trusted agent runtime. KeepDEEPLINE_API_KEY in server-side secret storage. Never put it in a browser
application or commit it to source control.
A successful response returns
rows, columns, row_count_returned, and
truncated. An empty rows array means the query ran but found no matches.max_rows to bound the result you need. Inspect returned columns, row count
and truncated before interpreting the answer. Test writes only in permitted
customer-owned objects.
Use the SDK
The SDK uses the same API boundary:Query rules
For example, an agent or application can create its own scratch table:
CREATE SCHEMA tenant_custom, followed by a separate qualified
CREATE TABLE tenant_custom.agent_notes (...) statement. Reserved names and
internal objects remain protected. See the Database contract.
Keep the boundary safe
- Build fixed, allowlisted queries in trusted server-side code. Validate request values and constrain permitted tables, columns and filters. Do not forward arbitrary end-user SQL.
- Set
max_rowsand select only the columns your caller needs. - Use the Database for working state. Write approved outcomes to your CRM. See Database.
Direct PostgreSQL access
Use a Database URI only for a database-native application or BI tool. Obtain it from the dashboard’s Database Access flow, store it in server-side secret storage, and write only to permitted customer storage objects. An owner or admin must use a dashboard session to reveal the URI. Provisioning and password rotation are also dashboard/admin-session controls, separate from the public query API.Query an external Postgres database
A connected Postgres database belongs to your own database provider. It usespostgres_run_query and saved integration credentials, separate from the
Deepline Database API and its managed-schema rules above. Follow the
external Postgres credential instructions,
including Supabase Session Pooler setup when needed.
The tool accepts one statement with positional binds, timeoutMs, and
rowLimit. Reads run in a read-only transaction; mutations and DDL execute
directly without a write opt-in. Use a read-only database role when writes
must be prohibited, and authorize external changes separately.
Inspect external tables, foreign keys, and a bounded join
Inspect external tables, foreign keys, and a bounded join
List user tables with the local Deepline CLI:Inspect declared foreign keys before choosing a join. Pair the source and target
columns by constraint position, including composite keys:For example, a Supabase project containing the PostgreSQL DVD Rental sample
schema can join actors to films through The response includes
film_actor:data.rows, data.rowCount, data.columns, the command
tag, and non-secret connection metadata such as the host, database, and schema.Use positional $1, $2 placeholders with binds for variable values, rather
than interpolating them into SQL. Bound reads with both SQL LIMIT and
rowLimit; inspect data.limited along with the returned count and columns.
The examples use the DVD Rental schema only where that sample is installed;
inspect your actual schema before choosing tables or joins.SDK API reference
See the supported
POST /api/v2/db/query contract and SDK method.