Add Opportunities in Bulk
Adds multiple opportunities to a lead. The lead is searched for based on any unique field in your account. You can add up to 25 opportunities in a single request.
- Specify the lead you want to add the opportunity to by passing any unique lead field.*
- Pass the field schema name in the
SearchByparameter in the API URL. - Pass the field value in the
SearchByValueattribute in the JSON body.
- Pass the field schema name in the
- The
OpportunityNoteandOpportunityOwnerEmailparameters are optional. - Specify the opportunity type you want to add to a lead by passing the
OpportunityEventCode. To obtain the event code, navigate to My Profile>Settings>Opportunities>Opportunity Types, and under the Code column, copy the event code for the relevant opportunity type.

*Default unique lead fields include EmailAddress, Phone and Mobile. However, you can set your own unique lead fields according to your business requirements.
Note: The opportunity will get created only if all mandatory fields are passed.
API URL
URL Parameters
| Parameter | Description |
|---|---|
| searchBy | The schema name of the unique lead field. E.g., EmailAddress, Phone, etc. |
Request
Content-Type: application/json[
{
"SearchByValue":"+91-2543456794",
"OpportunityEventCode":12114,
"OpportunityNote":"Add/ByEmailAddress",
"UpdateEmptyFields":true,
"DoNotChangeOwner":true,
"Fields":[
{
"SchemaName":"mx_Custom_1",
"Value":"XYZ"
},
{
"SchemaName":"mx_Custom_2",
"Value":"ABC"
},
{
"SchemaName":"mx_Custom_19",
"Value":"One"
},
{
"SchemaName":"Status",
"Value":"Open"
}
]
},
{
"SearchByValue":"+91-2543456791",
"OpportunityEventCode":12114,
"OpportunityNote":"Add/ByEmailAddress",
"UpdateEmptyFields":true,
"DoNotChangeOwner":true,
"Fields":[
{
"SchemaName":"mx_Custom_1",
"Value":"ABC"
},
{
"SchemaName":"mx_Custom_2",
"Value":"XYZ"
},
{
"SchemaName":"mx_Custom_19",
"Value":"One"
},
{
"SchemaName":"Status",
"Value":"Open"
}
]
}
]
Request Parameters
| Parameter | Description |
|---|---|
| SearchByValue | Value of the “SearchBy” attribute you passed in the API URL. For example, if you passed “EmailAddress” in the API URL, then pass “john@example.com” here. This is a mandatory field. |
| OpportunityEventCode | The opportunity event code. This is a mandatory field. |
| OpportunityNote | The description or notes associated with the opportunity. |
| OpportunityOwnerEmail | Email Id of the opportunity owner. |
| Fields | You can optionally pass custom opportunity fields here by specifying their “SchemaNames” and “Values”. E.g. “SchemaName”: “mx_Custom_1”, “Value”: “100”. |
| OverwriteFields | If you pass
|
| UpdateEmptyFields | If you pass |
| DoNotPostDuplicateActivity | If you pass |
| doNotChangeOwner | If you pass |
Response
{
"Response":[
{
"ProspectOpportunityId":"001ea287-b311-4b05-8d7f-2f398379801f",
"RowNumber":1,
"OpportunityCreated":true
},
{
"ProspectOpportunityId":"189eddf1-3bc6-4580-96b8-dc57e49eab12",
"RowNumber":2,
"OpportunityCreated":true
}
]
}
HTTP Response Codes
| Code | Description |
|---|---|
| 200 OK | This is the status code for successful API call. |
| 401 Unauthorized | The API call was made with invalid access credentials. Check your AccessKey and SecretKey. |
| 400 Bad Request | The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure. |
| 404 Not Found | The API could not be found. Please check the API signature. |
| 429 Too Many Requests | API calls exceeded the limit of 25 in 5 second(s) |
| 500 Internal Server Error | The API called failed. There could be many reasons for it. Check the exception message to get more details. |

