Skip to main content
For an application or agent, query the Database through the Deepline API. Your Deepline API key selects the workspace; the API runs one bounded SQL statement against that workspace’s Database. You do not need to expose a PostgreSQL connection string. Use a direct PostgreSQL URI only when a database-native tool, such as BI or psql, genuinely needs one.

Query the API securely

Send the request from your server, worker, or trusted agent runtime. Keep DEEPLINE_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.
The API accepts one SQL statement and up to 1,000 returned rows per request. Use max_rows to bound the result you need.

Use the SDK

The SDK uses the same API boundary:

Query rules

For example, an agent or application can create its own scratch table:
These statements are intentionally blocked:

Keep the boundary safe

  • Do not forward arbitrary browser input as SQL. Build queries in trusted server-side code and constrain the tables, columns, and filters your product permits.
  • Do not accept query text from an end user. Use fixed, allowlisted queries and validate request values before your server builds the SQL. Treat raw SQL as privileged input.
  • Set max_rows and select only the columns your caller needs.
  • Use the Database for working state. Write approved outcomes to your CRM; see Where data lives.

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 storage.*. Provisioning, URI reveal, and password rotation are dashboard/admin-session controls; they are not the public query API.

SDK API reference

See the supported POST /api/v2/db/query contract and SDK method.