Search Leads by Criteria

Returns leads based on criteria you define. For example, you can search for all leads that are created after a certain date or all leads where age > 22.

 

API URL

POST
https://{host}/v2/LeadManagement.svc/Leads.Get?accessKey=AccessKey&secretKey=SecretKey
Copy URL

Request

JSON Body/Payload

Content-Type: application/json

{
    "Parameter": {
        "LookupName": "CreatedOn",
        "LookupValue": "2015-01-01 14:36:59",
        "SqlOperator": ">"
    },
    "Columns": {
        "Include_CSV": "ProspectID, FirstName, LastName, EmailAddress"
    },
    "Sorting": {
        "ColumnName": "CreatedOn",
        "Direction": "1"
    },
    "Paging": {
        "PageIndex": 1,
        "PageSize": 100
    }
}

JSON Properties

Parameter Description
LookupName

Schema name of the lead field. For example, if you want to find all leads based on last name, then pass “LookupName”: “LastName”. To get the schema names for all lead fields use the LeadsMetaData API.

LookupValue

This is the search term. For example, if you want all leads who’s last name is Smith then pass “LookupValue”: “Smith”.

SqlOperator

Operator:  One of  =, IN, LIKE, >, <, <=, >=, <>

For an exact match pass “SqlOperator”:”=”

Include_CSV

Lead fields that should be included in the result.  Use the schema names of lead fields.

ColumnName

The column on which results will be sorted. For example, if you want results to be shown based on creation date, pass “CreatedOn”.

Direction

Direction “1” means descending order and “0” means ascending order.

PageIndex

The results matching your criteria may be large. You can fetch the result in blocks of “PageSize” and make multiple calls to the API with increasing values of “PageIndex”.  For example, you can specify “PageIndex”: 1, “PageSize”: 100 for the first call and specify “PageIndex”: 2, “PageSize”: 100 for second call.

PageSize

The results matching your criteria may be large. You can fetch the result in blocks of “PageSize” and make multiple calls to the API with increasing values of “PageIndex”.  For example, you can specify “PageIndex”: 1, “PageSize”: 100 for the first call and specify “PageIndex”: 2, “PageSize”: 100 for second call.

Response

200 OK

Content-Type: application/json

[
    {
        "ProspectID": "xxxxxxxx-xxxx-LEAD-IDxx-xxxxxxxxxxx",
        "FirstName": "first name",
        "LastName": "last name",
        "EmailAddress": "abc@yopmail.com"
    }
]

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.