LeadSquared Developer Centre


Opportunity Advanced Search

Lets you retrieve Opportunities using the advanced search criteria.

  • This API is only accessible to Administrator users.
  • OpportunityEventandAdvancedSearchare mandatory fields.
  • The AdvancedSearch criteria can be captured using theOpportunityGridnetwork call.
    1. Navigate to Leads>Manage Opportunities>Opportunity Type.
    2. From the Opportunity Grid, open your browser’s developer tools.
    3. Navigate to the Network tab, and search for ActivityGrid.
    4. From Form Data, copy theAdvancedSearchparameter value.
    5. You may have to use escape characters in the JSON (replace ” with \”). After you add it, then pass it in theAdvancedSearchparameter in the JSON payload.

Opportunity Advanced Search_1


  • For ESS customers, custom field sets are represented as mx_Custom_3~mx_CustomObject_1. Note that the “~” symbol may be shown in hexadecimal form as x007E. Please get in touch with your account manager to know whether your account has ESS enabled.
  • The time zone considered is Universal Time Coordinated (UTC). You may need to convert the time from your local time zone to UTC before passing it here.



POST https://{host}/v2/OpportunityManagement.svc/Retrieve/BySearchParameter?accessKey=AccessKey&secretKey=SecretKey


Content-Type: application/json
JSON Body/Payload Icon
   "AdvancedSearch":"{\"GrpConOp\":\"And\",\"Conditions\":[{\"Type\":\"Activity\",\"ConOp\":\"and\",\"RowCondition\":[{\"SubConOp\":\"And\",\"LSO\":\"ActivityEvent\",\"LSO_Type\":\"PAEvent\",\"Operator\":\"eq\",\"RSO\":\"12005\"}]}],\"QueryTimeZone\":\"India Standard Time\"}",

Request Parameters

Parameter Description

The code for the opportunity type. To find it, navigate to My Profile>Settings>Opportunities>Opportunity Type. It is listed under the column Code.

This is a mandatory field.


The advanced search criteria can be captured using the Activity Grid network call. See the process above for details.

This is a mandatory field.


PageIndex and 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”.

Note: Default page size is 25. Maximum page size is 1,000.


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, while “0” means ascending order.

Note: Default sorting is on activity ModifiedOn column as descending order


200 OK
Content-Type: application/json
         "CreatedOn":"2020-11-05 10:28:26",
         "ModifiedOn":"2020-12-10 10:10:28",
         "mx_Custom_1":"Rahul Sen - Loan",
         "mx_Custom_2":"Need Analysis",
         "mx_Custom_8":"2020-12-24 10:10:00",
         "CreatedOn":"2020-11-05 10:25:20",
         "ModifiedOn":"2020-12-10 10:10:08",
         "mx_Custom_1":"Arjun Shetty - Loan",
         "mx_Custom_2":"Decided not to buy",
         "mx_Custom_8":"2020-11-11 10:09:00",
         "CreatedOn":"2020-09-16 05:44:47",
         "ModifiedOn":"2020-10-16 06:10:54",
         "mx_Custom_1":"Manish Garg - Loan",
         "mx_Custom_2":"Closed - Won",
         "mx_Custom_8":"2020-11-06 05:45:00",

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.

On this page

© 2022 by MarketXpander Services Pvt Ltd. All Rights Reserved.