Run a Salesforce Bulk API 2.0 query job to extract all records from a large object with relationship fields, then download the results CSV in parts

domain: salesforce.com · 5 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 salesforce.com, checked against official docs, with linked verified routes.

Steps

  1. POST to /services/data/vXX.0/jobs/query with 'operation':'query' and a SOQL string that includes a parent relationship field (e.g. Account.Name on Contact) to create the query job
  2. Poll GET /services/data/vXX.0/jobs/query/{jobId} until 'state' is 'JobComplete', checking 'numberRecordsProcessed'
  3. GET /services/data/vXX.0/jobs/query/{jobId}/results?maxRecords=50000 with Accept: text/csv to download the first result chunk; capture the Sforce-Locator header value
  4. If Sforce-Locator is not null, repeat the GET with locator={value} query param to retrieve subsequent pages until the response header is null
  5. DELETE /services/data/vXX.0/jobs/query/{jobId} to abort if needed, or let it expire after the retention window

Known gotchas

Related routes

Run a Salesforce Bulk API 2.0 query job to extract large datasets and download multi-part result files
developer.salesforce.com · 6 steps · unrated
Configure a Salesforce Bulk API 2.0 query job to extract records with related fields and handle multi-part result downloads
developer.salesforce.com · 6 steps · unrated
Create and monitor a Salesforce Bulk API 2.0 ingest job for a large dataset
salesforce.com · 6 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