Use the Salesforce sObject Tree API to insert a parent record and multiple child records in one request

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. Construct a POST request to /services/data/vXX.0/composite/tree/<SObjectType> with a records array
  2. Each record in the array may contain a child records block using the relationship name to nest children
  3. Assign a referenceId string to every record so the response maps successes and errors back to your payload
  4. Submit the request; on success the response contains the new IDs keyed by referenceId
  5. On partial failure the entire transaction is rolled back; inspect the hasErrors flag and the results array to identify which referenceId failed
  6. Stay within the documented limit of records per call when nesting parent and child objects

Known gotchas

Related routes

Insert a parent record with multiple related child records in one request using the Salesforce sObject Tree API
salesforce.com · 6 steps · unrated
Execute a Salesforce Composite Graph API request to atomically insert a hierarchy of related records
salesforce.com · 6 steps · unrated
Execute a Salesforce Composite Graph API request to insert a hierarchy of related records atomically
developer.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