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
SearchBy
parameter in the API URL. - Pass the field value in the
SearchByValue
attribute in the JSON body.
- Pass the field schema name in the
- The
OpportunityNote
andOpportunityOwnerEmail
parameters 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
JSON Body/Payload
Content-Type: application/json
[
{
"SearchByValue":"kiran@example.com",
"OpportunityEventCode":12186,
"OpportunityNote":"Add/ByEmailAddress",
"OpportunityOwnerEmail":"Anu@example.com",
"Fields":[
{
"SchemaName":"mx_Custom_20",
"Value":"",
"Fields":[
{
"SchemaName":"mx_CustomObject_1",
"Value":"Galloctos"
}
]
},
{
"SchemaName":"mx_Custom_1",
"Value":"{{mx_Custom1}}"
},
{
"SchemaName":"mx_Custom_5",
"Value":"Description"
},
{
"SchemaName":"mx_Custom_6",
"Value":"123"
},
{
"SchemaName":"mx_Custom_8",
"Value":"2020-05-04 12:13:44"
},
{
"SchemaName":"mx_Custom_11",
"Value":"str origin"
},
{
"SchemaName":"mx_Custom_3",
"Value":"{{mx_Custom3}}"
},
{
"SchemaName":"mx_Custom_13",
"Value":"two"
},
{
"SchemaName":"mx_Custom_2",
"Value":"two"
},
{
"SchemaName":"mx_Custom_19",
"Value":"two"
},
{
"SchemaName":"Status",
"Value":"Won"
}
]
},
{
"SearchByValue":"megalists@example.com",
"OpportunityEventCode":12186,
"OpportunityNote":"Add/ByEmailAddress",
"OpportunityOwnerEmail":"Anu@example.com",
"Fields":[
{
"SchemaName":"mx_Custom_20",
"Value":"",
"Fields":[
{
"SchemaName":"mx_CustomObject_1",
"Value":"Galloctos"
}
]
},
{
"SchemaName":"mx_Custom_1",
"Value":"{{mx_Custom1}}"
},
{
"SchemaName":"mx_Custom_5",
"Value":"Description"
},
{
"SchemaName":"mx_Custom_6",
"Value":"123"
},
{
"SchemaName":"mx_Custom_8",
"Value":"2020-05-04 12:13:44"
},
{
"SchemaName":"mx_Custom_11",
"Value":"str origin"
},
{
"SchemaName":"mx_Custom_3",
"Value":"{{mx_Custom3}}"
},
{
"SchemaName":"mx_Custom_13",
"Value":"two"
},
{
"SchemaName":"mx_Custom_2",
"Value":"two"
},
{
"SchemaName":"mx_Custom_19",
"Value":"two"
},
{
"SchemaName":"Status",
"Value":"Won"
}
]
}
]
JSON Properties
[ { "SearchByValue":"kiran@example.com", "OpportunityEventCode":12186, "OpportunityNote":"Add/ByEmailAddress", "OpportunityOwnerEmail":"Anu@example.com", "Fields":[ { "SchemaName":"mx_Custom_20", "Value":"", "Fields":[ { "SchemaName":"mx_CustomObject_1", "Value":"Galloctos" } ] }, { "SchemaName":"mx_Custom_1", "Value":"{{mx_Custom1}}" }, { "SchemaName":"mx_Custom_5", "Value":"Description" }, { "SchemaName":"mx_Custom_6", "Value":"123" }, { "SchemaName":"mx_Custom_8", "Value":"2020-05-04 12:13:44" }, { "SchemaName":"mx_Custom_11", "Value":"str origin" }, { "SchemaName":"mx_Custom_3", "Value":"{{mx_Custom3}}" }, { "SchemaName":"mx_Custom_13", "Value":"two" }, { "SchemaName":"mx_Custom_2", "Value":"two" }, { "SchemaName":"mx_Custom_19", "Value":"two" }, { "SchemaName":"Status", "Value":"Won" } ] }, { "SearchByValue":"megalists@example.com", "OpportunityEventCode":12186, "OpportunityNote":"Add/ByEmailAddress", "OpportunityOwnerEmail":"Anu@example.com", "Fields":[ { "SchemaName":"mx_Custom_20", "Value":"", "Fields":[ { "SchemaName":"mx_CustomObject_1", "Value":"Galloctos" } ] }, { "SchemaName":"mx_Custom_1", "Value":"{{mx_Custom1}}" }, { "SchemaName":"mx_Custom_5", "Value":"Description" }, { "SchemaName":"mx_Custom_6", "Value":"123" }, { "SchemaName":"mx_Custom_8", "Value":"2020-05-04 12:13:44" }, { "SchemaName":"mx_Custom_11", "Value":"str origin" }, { "SchemaName":"mx_Custom_3", "Value":"{{mx_Custom3}}" }, { "SchemaName":"mx_Custom_13", "Value":"two" }, { "SchemaName":"mx_Custom_2", "Value":"two" }, { "SchemaName":"mx_Custom_19", "Value":"two" }, { "SchemaName":"Status", "Value":"Won" } ] } ]
JSON Properties
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”. |
Response
200 OK
Content-Type: application/json
{ "Response":[ { "ProspectOpportunityId":"001ea287-b311-4b05-8d7f-2f398379801f", "RowNumber":1, "OpportunityCreated":true }, { "ProspectOpportunityId":"189eddf1-3bc6-4580-96b8-dc57e49eab12", "RowNumber":2, "OpportunityCreated":true } ] }
HTTP Response Code
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. |