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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Cancel a running query if needed with DELETE /services/data/v62.0/ssot/query-sql/<queryId>.
  6. 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

Related routes

Build a Calculated Insight in Salesforce Data Cloud using the ANSI SQL editor to compute segment-level metrics
developer.salesforce.com · 6 steps · unrated
Execute Marketing Cloud Automation Studio SQL query activities programmatically using the SOAP API
developer.salesforce.com · 6 steps · unrated
Run a SOQL query with pagination from the Salesforce API
salesforce.com · 4 steps · unrated

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?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans