Execute a Salesforce Composite Graph API request to insert a hierarchy of related records atomically

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. Design the graph: identify the root node (e.g., Account) and dependent nodes (e.g., Contact, Opportunity, OpportunityContactRole) that must reference each other
  2. POST to /services/data/vXX.0/composite/graph with a body containing a graphs array; each graph object has a graphId string and a compositeRequest array of subrequest nodes
  3. Assign a referenceId to each subrequest node; in subsequent nodes, use @{referenceId.id} syntax to forward the ID returned by an earlier node without a client-side round trip
  4. Set allOrNone: true at the graph level to roll back all nodes in the graph if any single node fails — unlike the Composite API, Graph API commits or rolls back at the graph boundary
  5. Include up to 500 subrequests across all graphs in a single POST, with up to 25 graphs per request; verify current limits in documentation as they may change
  6. Parse the graphResponse array in the response: each element contains isSuccessful and a body matching standard sObject response format, with errors arrays for failures

Known gotchas

Related routes

Execute a Salesforce Composite Graph API request to atomically insert a hierarchy of related records
salesforce.com · 6 steps · unrated
Insert a parent record with multiple related child records in one request using the Salesforce sObject Tree API
salesforce.com · 6 steps · unrated
Use the Salesforce sObject Tree API to insert a parent record and multiple child records in one request
developer.salesforce.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ 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