Skip to content

Zoho: Merge Records

Zoho findAndMerge.mergeRecords: arguments, response, policy and SDK examples.

← Find and merge operations · Get started

Operation zoho.mergerecords

Provider route: POST /crm/v8/{module}/{masterRecordId}/actions/merge. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/zoho with npm, or alter-sdk-zoho with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { ZohoIntegration } from "@alter-ai/zoho";
async function execute(input: Parameters<ZohoIntegration["findAndMerge"]["mergeRecords"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new ZohoIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.findAndMerge.mergeRecords(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_zoho import ZohoIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = ZohoIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.find_and_merge.merge_records(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.masterRecordIdstringRequired within parentMaster record identifier (int64 as string)
Maximum length: 50
Pattern: ^[0-9]+$
path.modulestringRequired within parentValid CRM module name
One of: Accounts, Contacts, Leads, Deals, Cases, Campaigns
queryobjectOptionalAdditional keys: not allowed
query.featurestringOptionalOne of: web_record_approval
bodyobjectRequired within parentSpecify the merge configuration for the records to be consolidated.
Additional keys: not allowed
body.mergearrayRequired within parentSpecify the configurations for the merge. The array must contain exactly one object.
Maximum items: 1
body.merge[]objectEach itemEach object specifies the configuration for a single merge operation, including the child records to be merged and the field value selections for the merged record.
Additional keys: not allowed
body.merge[].dataarrayRequired within parentSpecify the child records to be merged into the master record. The array must contain a minimum of one and a maximum of two child record objects.
Maximum items: 2
Minimum items: 1
body.merge[].data[]objectEach itemEach object specifies the child record identifier and the fields whose values should be used in the merged record.
Additional keys: not allowed
body.merge[].data[]._fieldsarrayOptionalSpecify the API names of the fields from the child record whose values you wish to merge into the master record.
Maximum items: 100
body.merge[].data[]._fields[]objectEach itemEach object specifies the API name of the field and, for file upload or image upload fields, the attachment IDs to retain.
Additional keys: not allowed
body.merge[].data[]._fields[]._dataJSONOptionalIt represents the unique ID of a file or attachment. This field is specifically used for File Upload and Image Upload fields in a record. Use [GET Records API](record.yaml#$.paths./{module}.get) to retrieve the unique IDs of the files or attachments.
body.merge[].data[]._fields[]._data (anyOf 1)arrayAlternativeIt represents the unique ID of a file or attachment. This field is specifically used for File Upload and Image Upload fields in a record. Use [GET Records API](record.yaml#$.paths./{module}.get) to retrieve the unique IDs of the files or attachments.
Maximum items: 50
body.merge[].data[]._fields[]._data (anyOf 1)[]objectEach itemEach object specifies the unique identifier of the file or image attachment.
Additional keys: not allowed
body.merge[].data[]._fields[]._data (anyOf 1)[].idstringRequired within parentSpecify the unique numeric identifier of the file or image attachment.
Maximum length: 50
Pattern: ^[0-9]+$
body.merge[].data[]._fields[]._data (anyOf 2)nullAlternativeSet to null to delete all file or image attachments for this field in the merged record.
body.merge[].data[]._fields[].api_namestringRequired within parentRepresents the API name of the fields in the child record that you want to include in the merge.
Maximum length: 100
body.merge[].data[].idstringRequired within parentSpecify the unique identifier of the child record to be merged.
Maximum length: 50
Pattern: ^[0-9]+$
body.merge[].master_record_fieldsarrayOptionalSpecify the fields from the master record whose values should be retained in the merged record. Use this for file upload or image upload fields in the master record.
Maximum items: 100
body.merge[].master_record_fields[]objectEach itemEach object specifies the API name of a master record field like file upload or image upload fields, the attachment IDs to retain.
Additional keys: not allowed
body.merge[].master_record_fields[]._dataJSONOptionalSpecify the file or image attachment IDs to retain for this master record field, or set to null to delete all attachments for this field in the merged record.

> Notes
> - If an image upload or file upload is not specified, all the images/files in the master record will be retained.
> - If ‘_data’: null is provided, all the images/files for that specific field will be deleted.
> - If a child record has more than 1000 records in any of its related lists, then the merge action will be scheduled. This meas that it performs an asynchronous action, and the response to your request will not be available immediately. Instead, you will receive a unique job_id in the response. You can use this job_id to retrieve the status of your merge action. For details, please refer to the [Get Records Merge Status API](find_and_merge.yaml#$.paths./{module}/{masterRecordId}/actions/merge.get).
> - The merge JSON array can only contain one object, while the data JSON array can have a maximum of two child records. Exceeding these limits will result in errors.
> - Each field should only be mentioned once across the master_record_fields and data arrays.
> - Only open deals can be merged; closed deals will trigger an error.
> - The closing date, stage, probability, and expected revenue fields will be automatically populated based on the master record and should not be specified in the request.
> - Records currently locked or in an approval/review process cannot be merged.
body.merge[].master_record_fields[]._data (anyOf 1)arrayAlternativeSpecify the file or image attachment IDs to retain for this master record field, or set to null to delete all attachments for this field in the merged record.

> Notes
> - If an image upload or file upload is not specified, all the images/files in the master record will be retained.
> - If ‘_data’: null is provided, all the images/files for that specific field will be deleted.
> - If a child record has more than 1000 records in any of its related lists, then the merge action will be scheduled. This meas that it performs an asynchronous action, and the response to your request will not be available immediately. Instead, you will receive a unique job_id in the response. You can use this job_id to retrieve the status of your merge action. For details, please refer to the [Get Records Merge Status API](find_and_merge.yaml#$.paths./{module}/{masterRecordId}/actions/merge.get).
> - The merge JSON array can only contain one object, while the data JSON array can have a maximum of two child records. Exceeding these limits will result in errors.
> - Each field should only be mentioned once across the master_record_fields and data arrays.
> - Only open deals can be merged; closed deals will trigger an error.
> - The closing date, stage, probability, and expected revenue fields will be automatically populated based on the master record and should not be specified in the request.
> - Records currently locked or in an approval/review process cannot be merged.
Specify the file or image attachment IDs to retain for this master record field, or set to null to delete all attachments for this field in the merged record.

> Notes
> - If an image upload or file upload is not specified, all the images/files in the master record will be retained.
> - If ‘_data’: null is provided, all the images/files for that specific field will be deleted.
> - If a child record has more than 1000 records in any of its related lists, then the merge action will be scheduled. This meas that it performs an asynchronous action, and the response to your request will not be available immediately. Instead, you will receive a unique job_id in the response. You can use this job_id to retrieve the status of your merge action. For details, please refer to the [Get Records Merge Status API](find_and_merge.yaml#$.paths./{module}/{masterRecordId}/actions/merge.get).
> - The merge JSON array can only contain one object, while the data JSON array can have a maximum of two child records. Exceeding these limits will result in errors.
> - Each field should only be mentioned once across the master_record_fields and data arrays.
> - Only open deals can be merged; closed deals will trigger an error.
> - The closing date, stage, probability, and expected revenue fields will be automatically populated based on the master record and should not be specified in the request.
> - Records currently locked or in an approval/review process cannot be merged.

Maximum items: 50
body.merge[].master_record_fields[]._data (anyOf 1)[]objectEach itemSpecify the unique identifier of the file or image attachment to retain in the master record.
Additional keys: not allowed
body.merge[].master_record_fields[]._data (anyOf 1)[].idstringRequired within parentSpecify the unique identifier of the file or image attachment to retain.
Maximum length: 50
Pattern: ^[0-9]+$
body.merge[].master_record_fields[]._data (anyOf 2)nullAlternativeSet to null to delete all file or image attachments for this master record field in the merged record.
body.merge[].master_record_fields[].api_namestringRequired within parentSpecify the API name of the master record field to retain in the merged record.
Maximum length: 100

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$JSONRootResponse when the merge operation was initiated - either completed synchronously or scheduled asynchronously.
$ (anyOf 1)objectAlternativeResponse when the merge operation is completed or scheduled for processing.
Additional keys: not allowed
$ (anyOf 1).mergearrayRequired within parentContains the list of merge operation results indicating whether the merge completed or was scheduled.
Maximum items: 1
$ (anyOf 1).merge[]JSONEach itemEach object represents a merge result item indicating whether the operation completed synchronously or was scheduled for processing.
$ (anyOf 1).merge[] (anyOf 1)objectAlternativeSuccessful merge completion response, returned when the merge was processed synchronously.
Additional keys: not allowed
$ (anyOf 1).merge[] (anyOf 1).codestringRequired within parentRepresents the success code for a completed merge.
Possible values:
SUCCESS - The records were merged successfully.

Known values: SUCCESS
$ (anyOf 1).merge[] (anyOf 1).detailsobjectRequired within parentContains the details of the completed merge, including the ID of the master record retained after the merge.
Additional keys: not allowed
$ (anyOf 1).merge[] (anyOf 1).details.idstringRequired within parentRepresents the unique identifier of the master record retained after the merge.
Maximum length: 50
Pattern: ^[0-9]+$
$ (anyOf 1).merge[] (anyOf 1).messagestringRequired within parentRepresents the success message for the completed merge operation.
Maximum length: 500
$ (anyOf 1).merge[] (anyOf 1).statusstringRequired within parentRepresents the status of the merge operation.
Possible values:
success - The merge completed successfully.

Known values: success
$ (anyOf 1).merge[] (anyOf 2)objectAlternativeScheduled merge operation response, returned when the merge was queued for asynchronous processing.
Additional keys: not allowed
$ (anyOf 1).merge[] (anyOf 2).codestringRequired within parentRepresents the code indicating that the merge was scheduled for background processing.
Possible values:
SCHEDULED - The merge operation was queued for asynchronous processing.

Known values: SCHEDULED
$ (anyOf 1).merge[] (anyOf 2).detailsobjectRequired within parentContains the details of the scheduled merge, including the job ID for tracking the merge status.
Additional keys: not allowed
$ (anyOf 1).merge[] (anyOf 2).details.job_idstringRequired within parentRepresents the unique identifier of the scheduled merge job. Use this ID with the [Get Merge Job Status API](find_and_merge.yaml#$.paths./{module}/{masterRecordId}/actions/merge.get) to check the status of the merge.
Maximum length: 50
Pattern: ^[0-9]+$
$ (anyOf 1).merge[] (anyOf 2).messagestringRequired within parentRepresents the message about the scheduled merge operation.
Maximum length: 500
$ (anyOf 1).merge[] (anyOf 2).statusstringRequired within parentRepresents the status of the scheduling operation.
Possible values:
success - The merge was successfully scheduled.

Known values: success

SDK function policy ID: zoho.mergerecords. Catalog operation: mergeRecords. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.