This documentation shows that you need to use the
referenceID with each record to do batch creation.
Does Salesforce use this referenceID to achieve (per-record) idempotency?
Or will it just create a whole new record if I make multiple calls?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
I think what you are asking is whether the Reference Id becomes a persistent Id, such that calling the Composite REST API multiple times and providing the same Reference Id is idempotent.
The answer to that is no. The Reference Id has validity only within the scope of one call (with however many subrequests) to the Composite API. Your application must consume the returned result to correlate the Reference Ids you supplied with either Salesforce Ids, which are persistent and which you may reference in future update/upsert requests, or with errors.
If you include multiple subrequests within the same call to Composite, you may use Reference Ids to tie those subrequests together, such as a request to create an Account and subsequently create a Contact under it.