Get Activities by Date Range
Retrieves all activities posted on leads and opportunities within a given time frame. The FromDate and ToDate must be specified in yyyy-mm-dd hh:mm:ss format. Pass IncludeCustomFields: 1 to include activity custom fields in the response.
Note:
- To retrieve the
RelatedOpportunityId
, you’ll have to get this feature enabled on your account. To do this, contact your account manager, or write to support@leadsquared.com. - Custom field sets will be returned in the response if associated with the activity.
- The time zone considered is Universal Time Coordinated (UTC). You may need to convert the time from your local timezone to UTC before passing it here.
API URL
Request
Content-Type: application/json{ "Parameter":{ "FromDate":"2022-10-21 00:00:00", "ToDate":"2022-10-21 23:59:59", "IncludeCustomFields":1 }, "Paging":{ "PageIndex":1, "PageSize":20 }, "Sorting":{ "ColumnName":"CreatedOn", "Direction":1 } }
Request Parameters
Parameter | Description |
---|---|
FromDate | Beginning of the date range |
ToDate | End of the date range |
IncludeCustomFields | Returns activity custom fields.
|
PageIndex | The results set 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 the second call. |
PageSize | The results set 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 the second call. |
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. |
Response
{ "RecordCount":5, "ProspectActivities":[ { "Id":"75d4d47f-6d41-48da-b385-003675b9d841", "EventCode":208, "EventName":"Documents", "ActivityScore":0, "CreatedOn":"2022-10-21 07:21:13", "ActivityType":2, "IsEmailType":false, "Type":"Inbound", "SessionId":"75d4d47f-6d41-48da-b385-003675b9d841", "TrackLocation":0, "Latitude":0, "Longitude":0, "RelatedProspectId":"0e685796-0a55-11ec-b86b-02506fc2b3ce", "Data":[ { "Key":"CreatedByName", "Value":"Srisudhan" }, { "Key":"EventName", "Value":"Documents" }, { "Key":"NotableEventDescription", "Value":"" }, { "Key":"HasAttachments", "Value":"False" } ], "Fields":[ { "Key":"mx_Custom_1", "Value":null }, { "Key":"mx_Custom_2", "Value":null }, { "Key":"mx_Custom_3", "Value":null }, { "Key":"mx_Custom_4", "Value":null }, { "Key":"mx_Custom_5", "Value":null }, { "Key":"mx_Custom_6", "Value":null }, { "Key":"mx_Custom_7", "Value":null }, { "Key":"mx_Custom_8", "Value":null }, { "Key":"mx_Custom_9", "Value":null }, { "Key":"mx_Custom_10", "Value":null }, { "Key":"mx_Custom_11", "Value":null }, { "Key":"mx_Custom_12", "Value":null }, { "Key":"mx_Custom_13", "Value":null }, { "Key":"mx_Custom_14", "Value":null }, { "Key":"mx_Custom_15", "Value":null }, { "Key":"mx_Custom_16", "Value":null }, { "Key":"mx_Custom_17", "Value":null }, { "Key":"mx_Custom_18", "Value":null }, { "Key":"mx_Custom_19", "Value":null }, { "Key":"mx_Custom_20", "Value":null }, { "Key":"mx_Custom_21", "Value":null }, { "Key":"mx_Custom_22", "Value":null }, { "Key":"mx_Custom_23", "Value":null }, { "Key":"mx_Custom_24", "Value":null }, { "Key":"mx_Custom_25", "Value":null }, { "Key":"mx_Custom_26", "Value":null }, { "Key":"mx_Custom_27", "Value":null }, { "Key":"mx_Custom_28", "Value":null }, { "Key":"mx_Custom_29", "Value":null }, { "Key":"mx_Custom_30", "Value":null }, { "Key":"mx_Custom_31", "Value":null }, { "Key":"mx_Custom_32", "Value":null }, { "Key":"mx_Custom_33", "Value":null }, { "Key":"mx_Custom_34", "Value":null }, { "Key":"mx_Custom_35", "Value":null }, { "Key":"mx_Custom_36", "Value":null }, { "Key":"mx_Custom_37", "Value":null }, { "Key":"mx_Custom_38", "Value":null }, { "Key":"mx_Custom_39", "Value":null }, { "Key":"mx_Custom_40", "Value":null }, { "Key":"mx_Custom_41", "Value":null }, { "Key":"mx_Custom_42", "Value":null }, { "Key":"mx_Custom_43", "Value":null }, { "Key":"mx_Custom_44", "Value":null }, { "Key":"mx_Custom_45", "Value":null }, { "Key":"mx_Custom_46", "Value":null }, { "Key":"mx_Custom_47", "Value":null }, { "Key":"mx_Custom_48", "Value":null }, { "Key":"mx_Custom_49", "Value":null }, { "Key":"mx_Custom_50", "Value":null }, { "Key":"Status", "Value":null }, { "Key":"Owner", "Value":null }, { "Key":"ProspectActivityId", "Value":"75d4d47f-6d41-48da-b385-003675b9d841" }, { "Key":"ActivityEvent", "Value":"208" } ], "ModifiedOn":"2022-10-21 07:21:14" }, { "Id":"c32cb567-36a5-44cc-a43f-31bfbbdd603a", "EventCode":208, "EventName":"Documents", "ActivityScore":0, "CreatedOn":"2022-10-21 07:21:13", "ActivityType":2, "IsEmailType":false, "Type":"Inbound", "SessionId":"c32cb567-36a5-44cc-a43f-31bfbbdd603a", "TrackLocation":0, "Latitude":0, "Longitude":0, "RelatedProspectId":"0e6856c5-0a55-11ec-b86b-02506fc2b3ce", "Data":[ { "Key":"CreatedByName", "Value":"Srisudhan" }, { "Key":"EventName", "Value":"Documents" }, { "Key":"NotableEventDescription", "Value":"" }, { "Key":"HasAttachments", "Value":"False" } ], "Fields":[ { "Key":"mx_Custom_1", "Value":null }, { "Key":"mx_Custom_2", "Value":null }, { "Key":"mx_Custom_3", "Value":null }, { "Key":"mx_Custom_4", "Value":null }, { "Key":"mx_Custom_5", "Value":null }, { "Key":"mx_Custom_6", "Value":null }, { "Key":"mx_Custom_7", "Value":null }, { "Key":"mx_Custom_8", "Value":null }, { "Key":"mx_Custom_9", "Value":null }, { "Key":"mx_Custom_10", "Value":null }, { "Key":"mx_Custom_11", "Value":null }, { "Key":"mx_Custom_12", "Value":null }, { "Key":"mx_Custom_13", "Value":null }, { "Key":"mx_Custom_14", "Value":null }, { "Key":"mx_Custom_15", "Value":null }, { "Key":"mx_Custom_16", "Value":null }, { "Key":"mx_Custom_17", "Value":null }, { "Key":"mx_Custom_18", "Value":null }, { "Key":"mx_Custom_19", "Value":null }, { "Key":"mx_Custom_20", "Value":null }, { "Key":"mx_Custom_21", "Value":null }, { "Key":"mx_Custom_22", "Value":null }, { "Key":"mx_Custom_23", "Value":null }, { "Key":"mx_Custom_24", "Value":null }, { "Key":"mx_Custom_25", "Value":null }, { "Key":"mx_Custom_26", "Value":null }, { "Key":"mx_Custom_27", "Value":null }, { "Key":"mx_Custom_28", "Value":null }, { "Key":"mx_Custom_29", "Value":null }, { "Key":"mx_Custom_30", "Value":null }, { "Key":"mx_Custom_31", "Value":null }, { "Key":"mx_Custom_32", "Value":null }, { "Key":"mx_Custom_33", "Value":null }, { "Key":"mx_Custom_34", "Value":null }, { "Key":"mx_Custom_35", "Value":null }, { "Key":"mx_Custom_36", "Value":null }, { "Key":"mx_Custom_37", "Value":null }, { "Key":"mx_Custom_38", "Value":null }, { "Key":"mx_Custom_39", "Value":null }, { "Key":"mx_Custom_40", "Value":null }, { "Key":"mx_Custom_41", "Value":null }, { "Key":"mx_Custom_42", "Value":null }, { "Key":"mx_Custom_43", "Value":null }, { "Key":"mx_Custom_44", "Value":null }, { "Key":"mx_Custom_45", "Value":null }, { "Key":"mx_Custom_46", "Value":null }, { "Key":"mx_Custom_47", "Value":null }, { "Key":"mx_Custom_48", "Value":null }, { "Key":"mx_Custom_49", "Value":null }, { "Key":"mx_Custom_50", "Value":null }, { "Key":"Status", "Value":null }, { "Key":"Owner", "Value":null }, { "Key":"ProspectActivityId", "Value":"c32cb567-36a5-44cc-a43f-31bfbbdd603a" }, { "Key":"ActivityEvent", "Value":"208" } ], "ModifiedOn":"2022-10-21 07:21:13" }, { "Id":"2c427f80-c3db-48eb-abed-0ecb0fa79333", "EventCode":208, "EventName":"Documents", "ActivityScore":0, "CreatedOn":"2022-10-21 07:21:12", "ActivityType":2, "IsEmailType":false, "Type":"Inbound", "SessionId":"2c427f80-c3db-48eb-abed-0ecb0fa79333", "TrackLocation":0, "Latitude":0, "Longitude":0, "RelatedProspectId":"a5232b12-8ba4-424b-9f75-5c937dd2a9c8", "Data":[ { "Key":"CreatedByName", "Value":"Srisudhan" }, { "Key":"EventName", "Value":"Documents" }, { "Key":"NotableEventDescription", "Value":"" }, { "Key":"HasAttachments", "Value":"False" } ], "Fields":[ { "Key":"mx_Custom_1", "Value":null }, { "Key":"mx_Custom_2", "Value":null }, { "Key":"mx_Custom_3", "Value":null }, { "Key":"mx_Custom_4", "Value":null }, { "Key":"mx_Custom_5", "Value":null }, { "Key":"mx_Custom_6", "Value":null }, { "Key":"mx_Custom_7", "Value":null }, { "Key":"mx_Custom_8", "Value":null }, { "Key":"mx_Custom_9", "Value":null }, { "Key":"mx_Custom_10", "Value":null }, { "Key":"mx_Custom_11", "Value":null }, { "Key":"mx_Custom_12", "Value":null }, { "Key":"mx_Custom_13", "Value":null }, { "Key":"mx_Custom_14", "Value":null }, { "Key":"mx_Custom_15", "Value":null }, { "Key":"mx_Custom_16", "Value":null }, { "Key":"mx_Custom_17", "Value":null }, { "Key":"mx_Custom_18", "Value":null }, { "Key":"mx_Custom_19", "Value":null }, { "Key":"mx_Custom_20", "Value":null }, { "Key":"mx_Custom_21", "Value":null }, { "Key":"mx_Custom_22", "Value":null }, { "Key":"mx_Custom_23", "Value":null }, { "Key":"mx_Custom_24", "Value":null }, { "Key":"mx_Custom_25", "Value":null }, { "Key":"mx_Custom_26", "Value":null }, { "Key":"mx_Custom_27", "Value":null }, { "Key":"mx_Custom_28", "Value":null }, { "Key":"mx_Custom_29", "Value":null }, { "Key":"mx_Custom_30", "Value":null }, { "Key":"mx_Custom_31", "Value":null }, { "Key":"mx_Custom_32", "Value":null }, { "Key":"mx_Custom_33", "Value":null }, { "Key":"mx_Custom_34", "Value":null }, { "Key":"mx_Custom_35", "Value":null }, { "Key":"mx_Custom_36", "Value":null }, { "Key":"mx_Custom_37", "Value":null }, { "Key":"mx_Custom_38", "Value":null }, { "Key":"mx_Custom_39", "Value":null }, { "Key":"mx_Custom_40", "Value":null }, { "Key":"mx_Custom_41", "Value":null }, { "Key":"mx_Custom_42", "Value":null }, { "Key":"mx_Custom_43", "Value":null }, { "Key":"mx_Custom_44", "Value":null }, { "Key":"mx_Custom_45", "Value":null }, { "Key":"mx_Custom_46", "Value":null }, { "Key":"mx_Custom_47", "Value":null }, { "Key":"mx_Custom_48", "Value":null }, { "Key":"mx_Custom_49", "Value":null }, { "Key":"mx_Custom_50", "Value":null }, { "Key":"Status", "Value":null }, { "Key":"Owner", "Value":null }, { "Key":"ProspectActivityId", "Value":"2c427f80-c3db-48eb-abed-0ecb0fa79333" }, { "Key":"ActivityEvent", "Value":"208" } ], "ModifiedOn":"2022-10-21 07:21:13" }, { "Id":"5b325291-a224-4198-8148-afc668cac08f", "EventCode":208, "EventName":"Documents", "ActivityScore":0, "CreatedOn":"2022-10-21 07:20:00", "ActivityType":2, "IsEmailType":false, "Type":"Inbound", "SessionId":"5b325291-a224-4198-8148-afc668cac08f", "TrackLocation":0, "Latitude":0, "Longitude":0, "RelatedProspectId":"974da7a2-d0a1-4225-8938-62bb57bc4f54", "Data":[ { "Key":"CreatedByName", "Value":"Srisudhan" }, { "Key":"EventName", "Value":"Documents" }, { "Key":"NotableEventDescription", "Value":"" }, { "Key":"HasAttachments", "Value":"False" } ], "Fields":[ { "Key":"mx_Custom_1", "Value":null }, { "Key":"mx_Custom_2", "Value":null }, { "Key":"mx_Custom_3", "Value":null }, { "Key":"mx_Custom_4", "Value":null }, { "Key":"mx_Custom_5", "Value":null }, { "Key":"mx_Custom_6", "Value":null }, { "Key":"mx_Custom_7", "Value":null }, { "Key":"mx_Custom_8", "Value":null }, { "Key":"mx_Custom_9", "Value":null }, { "Key":"mx_Custom_10", "Value":null }, { "Key":"mx_Custom_11", "Value":null }, { "Key":"mx_Custom_12", "Value":null }, { "Key":"mx_Custom_13", "Value":null }, { "Key":"mx_Custom_14", "Value":null }, { "Key":"mx_Custom_15", "Value":null }, { "Key":"mx_Custom_16", "Value":null }, { "Key":"mx_Custom_17", "Value":null }, { "Key":"mx_Custom_18", "Value":null }, { "Key":"mx_Custom_19", "Value":null }, { "Key":"mx_Custom_20", "Value":null }, { "Key":"mx_Custom_21", "Value":null }, { "Key":"mx_Custom_22", "Value":null }, { "Key":"mx_Custom_23", "Value":null }, { "Key":"mx_Custom_24", "Value":null }, { "Key":"mx_Custom_25", "Value":null }, { "Key":"mx_Custom_26", "Value":null }, { "Key":"mx_Custom_27", "Value":null }, { "Key":"mx_Custom_28", "Value":null }, { "Key":"mx_Custom_29", "Value":null }, { "Key":"mx_Custom_30", "Value":null }, { "Key":"mx_Custom_31", "Value":null }, { "Key":"mx_Custom_32", "Value":null }, { "Key":"mx_Custom_33", "Value":null }, { "Key":"mx_Custom_34", "Value":null }, { "Key":"mx_Custom_35", "Value":null }, { "Key":"mx_Custom_36", "Value":null }, { "Key":"mx_Custom_37", "Value":null }, { "Key":"mx_Custom_38", "Value":null }, { "Key":"mx_Custom_39", "Value":null }, { "Key":"mx_Custom_40", "Value":null }, { "Key":"mx_Custom_41", "Value":null }, { "Key":"mx_Custom_42", "Value":null }, { "Key":"mx_Custom_43", "Value":null }, { "Key":"mx_Custom_44", "Value":null }, { "Key":"mx_Custom_45", "Value":null }, { "Key":"mx_Custom_46", "Value":null }, { "Key":"mx_Custom_47", "Value":null }, { "Key":"mx_Custom_48", "Value":null }, { "Key":"mx_Custom_49", "Value":null }, { "Key":"mx_Custom_50", "Value":null }, { "Key":"Status", "Value":"Active" }, { "Key":"Owner", "Value":null }, { "Key":"ProspectActivityId", "Value":"5b325291-a224-4198-8148-afc668cac08f" }, { "Key":"ActivityEvent", "Value":"208" } ], "ModifiedOn":"2022-10-21 07:20:13", "RelatedOpportunityId":"486e3bda-6291-425c-8d1f-bdfd3aa26713" }, { "Id":"6a18c007-38bc-46d6-a2ca-95221cb64c40", "EventCode":208, "EventName":"Documents", "ActivityScore":0, "CreatedOn":"2022-10-21 07:20:00", "ActivityType":2, "IsEmailType":false, "Type":"Inbound", "SessionId":"6a18c007-38bc-46d6-a2ca-95221cb64c40", "TrackLocation":0, "Latitude":0, "Longitude":0, "RelatedProspectId":"af26621b-c484-4db8-829e-b23a99318b2e", "Data":[ { "Key":"CreatedByName", "Value":"Srisudhan" }, { "Key":"EventName", "Value":"Documents" }, { "Key":"NotableEventDescription", "Value":"" }, { "Key":"HasAttachments", "Value":"False" } ], "Fields":[ { "Key":"mx_Custom_1", "Value":null }, { "Key":"mx_Custom_2", "Value":null }, { "Key":"mx_Custom_3", "Value":null }, { "Key":"mx_Custom_4", "Value":null }, { "Key":"mx_Custom_5", "Value":null }, { "Key":"mx_Custom_6", "Value":null }, { "Key":"mx_Custom_7", "Value":null }, { "Key":"mx_Custom_8", "Value":null }, { "Key":"mx_Custom_9", "Value":null }, { "Key":"mx_Custom_10", "Value":null }, { "Key":"mx_Custom_11", "Value":null }, { "Key":"mx_Custom_12", "Value":null }, { "Key":"mx_Custom_13", "Value":null }, { "Key":"mx_Custom_14", "Value":null }, { "Key":"mx_Custom_15", "Value":null }, { "Key":"mx_Custom_16", "Value":null }, { "Key":"mx_Custom_17", "Value":null }, { "Key":"mx_Custom_18", "Value":null }, { "Key":"mx_Custom_19", "Value":null }, { "Key":"mx_Custom_20", "Value":null }, { "Key":"mx_Custom_21", "Value":null }, { "Key":"mx_Custom_22", "Value":null }, { "Key":"mx_Custom_23", "Value":null }, { "Key":"mx_Custom_24", "Value":null }, { "Key":"mx_Custom_25", "Value":null }, { "Key":"mx_Custom_26", "Value":null }, { "Key":"mx_Custom_27", "Value":null }, { "Key":"mx_Custom_28", "Value":null }, { "Key":"mx_Custom_29", "Value":null }, { "Key":"mx_Custom_30", "Value":null }, { "Key":"mx_Custom_31", "Value":null }, { "Key":"mx_Custom_32", "Value":null }, { "Key":"mx_Custom_33", "Value":null }, { "Key":"mx_Custom_34", "Value":null }, { "Key":"mx_Custom_35", "Value":null }, { "Key":"mx_Custom_36", "Value":null }, { "Key":"mx_Custom_37", "Value":null }, { "Key":"mx_Custom_38", "Value":null }, { "Key":"mx_Custom_39", "Value":null }, { "Key":"mx_Custom_40", "Value":null }, { "Key":"mx_Custom_41", "Value":null }, { "Key":"mx_Custom_42", "Value":null }, { "Key":"mx_Custom_43", "Value":null }, { "Key":"mx_Custom_44", "Value":null }, { "Key":"mx_Custom_45", "Value":null }, { "Key":"mx_Custom_46", "Value":null }, { "Key":"mx_Custom_47", "Value":null }, { "Key":"mx_Custom_48", "Value":null }, { "Key":"mx_Custom_49", "Value":null }, { "Key":"mx_Custom_50", "Value":null }, { "Key":"Status", "Value":"Active" }, { "Key":"Owner", "Value":null }, { "Key":"ProspectActivityId", "Value":"6a18c007-38bc-46d6-a2ca-95221cb64c40" }, { "Key":"ActivityEvent", "Value":"208" } ], "ModifiedOn":"2022-10-21 07:20:13", "RelatedOpportunityId":"519fc1ca-8ad8-4ad9-b177-b8e734ca59e7" } ] }
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. |