Hi @piyushdatazip
To achieve your goal of populating data more quickly and retaining the `subscription_plan` data history, you can make use of pagination and partial responses. Here’s a suggested approach:
1. Use the `POST /crm/v3/objects/contacts/search` API endpoint as you have been doing, filtering by the specific business unit ID.
2. Adjust the `limit` parameter in the request to retrieve a smaller number of contacts per page. Start with a reasonable value, such as 100 or 500, and you can fine-tune it based on your performance requirements.
3. When making the initial request, include the `properties` parameter to specify the contact properties you want to retrieve, as you have already done.
4. To include the `subscription_plan` property history, you need to use the `associations` parameter. Modify your request JSON as follows:
```json
{
“filterGroups”: [
{
“filters”: [
{
“propertyName”: “hs_all_assigned_business_unit_ids”,
“operator”: “EQ”,
“value”: “380115”
}
]
}
],
“properties”: [“work_email”, “street_address”, “customerid_plan”, “my_login_username”, “subscription_plan”],
“associations”: {
“property”: “subscription_plan”,
“type”: “HISTORY”
}
}
```
This modification instructs the API to include the history of the `subscription_plan` property in the response.
5. The response you receive will contain a `paging` object with information about the total number of contacts and the number of pages available. You can use this information to implement pagination.
6. Iterate through the pages by making subsequent requests using the `after` parameter, which should be set to the value of the `after` field in the `paging` object of the previous response. This allows you to retrieve the next set of contacts.
By implementing pagination and partial responses, you can retrieve the data more quickly while ensuring that the `subscription_plan` property history is included. This approach helps reduce the likelihood of timeout errors and provides a more efficient way to handle a large number of contacts.
Hope this will helps you out. Please mark it as ACCEPTED SOLUTION to help other Community member.
Thanks!