Convert a Visitor to a Lead

This API allows you to convert a tracked website visitor to lead.

LeadSquared tracks each unique web visitor – even which are not converted into a Lead using a tracking ID. Using this ID, LeadSquared retrieves the Leadsource, visitor’s website behaviour, location and so on. This tracking ID is available using a JavaScript variable called MXCProspectId.  You can verify if your visitors are being tracked by looking for MXCProspectId variable in Console of your browser as shown below. If you see a unique value after you type MXCProspectId , it means that unknown visitors are being tracked.

MXCProspectId

You should get MXCProspectId on your webpage using custom JavaScript code.  This MXCProspectId is passed as the ProspectId in the JSON body of the Lead.Capture API if you intend to convert and existing visitor to Lead.

Note: Check Lead Capture API  also. Its a powerful alternative of this (Lead.Convert) API. 

API URL

POST
https://{host}/v2/LeadManagement.svc/Lead.Convert?accessKey=AccessKey&secretKey=SecretKey&leadId=MXCProspectId
Copy URL

URL Parameters

Parameter Description
MXCProspectId Value of MXCProspectId

Request

JSON Body/Payload

Content-Type: application/json

[
    {
        "Attribute": "Company",
        "Value": "MarketXpander Services"
    },
    {
        "Attribute": "OwnerId",
        "Value": "ID of the user who will own this record"
    }
]

JSON Properties

Parameter Description
Attribute

Scheme name of Lead field. To get Schema name for all Lead fields, use the LeadsMetaData API.

Value

Value of the given attribute that you provide

Response

200 OK

Content-Type: application/json

{
 "Status":"Success",
 "Message":{
            "AffectedRows":1
           }
}

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.