Customer Data Access
This guide is for building product features on your workspace data quickly. It covers two access paths:query_customer_db, the agent-callable tool for bounded SQL reads andstorage-scoped writes.- Direct PostgreSQL connection URIs for apps, BI tools, and admin workflows.
What You Get
- One dedicated database per workspace.
- Ready-to-query views for people and companies.
- An agent-writable
storageschema forquery_customer_db. - Direct connection roles for application and reporting access.
Agent Tool: query_customer_db
Use query_customer_db when Claude, Codex, or another agent needs to inspect
workspace data through Deepline APIs.
query_customer_db runs one SQL statement at a time. It supports:
SELECT,EXPLAIN, and read-onlyWITHqueries.- Aggregate queries such as
SELECT count(*) .... INSERT,UPDATE,DELETE,CREATE TABLE,CREATE INDEX,ALTER TABLE,DROP TABLE, andTRUNCATEonly for schema-qualifiedstorage.<table>targets.
storage schema is the safe write path for agent-created tables and
scratch state:
query_customer_db for arbitrary DDL or migrations. These examples
are blocked:
Only read statements or schema-qualified storage tables are supported. or Customer DB writes are only allowed for schema-qualified storage tables., rewrite the statement to target storage.<table> exactly, or make the
query read-only.
Quick Start: Get Access in Minutes
Use this flow when you need a direct PostgreSQL connection string.1) Check workspace database status
Use:2) Provision if needed
If not provisioned, run:provisioned is true and plane status is active.
3) Reveal a connection URI
Use:storage schema.
Use the same storage.<table> convention for app-created tables unless you are
working through a separate admin/runtime migration path.
4) Connect from your app
Build Features Fast (Vibe-Coding Patterns)
Read customer records for app screens
Use:dl_resolved.peopledl_resolved.companies
Store app-specific objects through the agent tool
Create agent-owned tables instorage:
API Endpoints You Will Use
GET /api/v2/ingestion/status- Check whether your workspace database is provisioned and active (API key or session auth).
POST /api/v2/ingestion/provision- Create database resources for the current workspace (dashboard/admin session).
GET /api/v2/ingestion/connection-uris/metadata- Return project/database/role metadata for active workspaces (dashboard/admin session).
POST /api/v2/ingestion/connection-uris/reveal- Reveal a pooled URI for
customer_db(dashboard/admin session).
- Reveal a pooled URI for
POST /api/v2/ingestion/connection-uris/rotate- Rotate the customer DB role password (dashboard/admin session).
Deep Reference: Schema Contract
Managed schemas (platform-owned)
dl_cacheperson_enrichmentscompany_enrichments
dl_overrideperson_overridescompany_overrides
dl_resolvedpeople(view)companies(view)
dl_metaschema_migrationstenant_settings
Agent storage schema
storage- DDL and DML allowed for
query_customer_dband the customer DB role. - Always schema-qualify writes as
storage.<table>.
- DDL and DML allowed for
Deep Reference: Role Access
- Customer DB role
- Read access to permitted workspace schemas.
- DDL and DML on
storage.*.
- Runtime role
- Internal app/runtime operations across managed schemas.
Operational Notes
- Database access is workspace-scoped, not user-scoped.
- If the backing project was deleted manually, run
POST /api/v2/ingestion/provisionagain. - Branch lifecycle is platform-managed for this tenant model.
query_customer_dbaccepts a single SQL statement. Do not prependSET search_path; schema-qualify table names instead.