Skip to main content

Upsert Account

POST 

/account/upsert

Creates or updates an account from an external system's data, such as a CRM or integration sync. An existing account is matched by accountId, sourceId, or externalLeadId, then by address; an address match on another user's account follows the company's duplicate account setting and may create a new account. The owner and closer are resolved to Terros users by userId, clientUserId, email, name, or phone. actorId may be a User ID, email, or clientUserId; omit it to attribute generated workflow history to the authenticated user. Use the 'requestType' field to control behavior: 'add' errors if the account already exists, 'update' errors if the account does not exist, and 'upsert' (default) creates or updates as needed. When an existing account is found by sourceId, that lookup uses sourceId alone. accountSource is not required and is not part of the key. Updating a matched account requires the same permissions as /account/update: the caller must be able to view the account and be its owner or closer, or hold the account:save permission. An omitted teamId keeps the account's team. Changing the owner, closer, or team also requires account:manage. A workflow action restricted to roles requires one of those roles. Creating an account requires the account:add permission, as /account/add does. Use /account/add or /account/update instead for direct edits when you have Terros IDs, and /account/match to look up an account without writing.

Request​

Responses​

Success