Execute an ANSI SQL query over Salesforce Data Cloud (Data 360) data using the Query API
domain: developer.salesforce.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
In-depth guide
Salesforce Bulk API 2.0 limits — the full failure-mode walkthrough related to developer.salesforce.com, checked against official docs, with linked verified routes.
Steps
Authenticate and obtain a Data Cloud-scoped access token; the Data Cloud Query API is accessed via Connect REST endpoints on the Salesforce org at /services/data/vXX.0/ssot/query.
Submit a synchronous query using POST /services/data/v62.0/ssot/query with body {"sql": "SELECT ... FROM <DMO_ApiName> WHERE ..."}; small result sets are returned immediately in the response.
For larger result sets or async execution, use POST /services/data/v62.0/ssot/query-sql (Query Connect API) and receive a queryId in the response; poll GET /services/data/v62.0/ssot/query-sql/<queryId> for status.
Retrieve rows from a completed async query via GET /services/data/v62.0/ssot/query-sql/<queryId>/rows; follow the nextPageUrl in the response to paginate through all result pages.
Cancel a running query if needed with DELETE /services/data/v62.0/ssot/query-sql/<queryId>.
Reference DMO API names exactly as defined in Data Cloud Setup; use the /api/v1/metadata/ endpoint to enumerate available objects and their field names.
Known gotchas
Data Cloud SQL supports a subset of ANSI SQL — joins across DMO categories (Profile, Engagement, Other) are permitted but must reference the unified individual's ssot__Id__c correctly.
Query results reflect the latest resolved state of the lakehouse; they are not real-time and may lag ingestion by the identity resolution processing window.
The synchronous /ssot/query endpoint has a shorter timeout than the async /ssot/query-sql path; use async for anything that might scan large DMOs.
Give your agent this knowledge — and 15,600+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?