Design the graph: identify the root node (e.g., Account) and dependent nodes (e.g., Contact, Opportunity, OpportunityContactRole) that must reference each other
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
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
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
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
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
Forward references using @{referenceId.fieldName} only work for fields returned in the response body of the referenced subrequest — you cannot forward a field that wasn't in the referenced sObject's response
Unlike the Composite API's allOrNone, the Graph API's rollback scope is per-graph, not per-request — if you have multiple graphs in one request, a failure in graph 2 does not roll back a committed graph 1
Composite Graph does not support query subrequests (GET with SOQL) — it is insert/update/delete only; mix in a separate Composite API call if you need to query before writing
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp