How to Get Active and Recently Expired Subscriptions from HubSpot
By default, subscription data in HubSpot is often filtered based solely on status. However, certain business use cases require fetching not only active subscriptions but also those that have expired within the past three months. This article outlines how to achieve that using a custom field and a structured query. How to Calculate Time Since Subscription End Date in HubSpot To begin, create a custom calculated property in HubSpot that determines the time difference between the current date and the subscription’s end date. This property will allow you to filter subscriptions based on how long ago they expired.The calculated field should return the difference in milliseconds between today and the end date. HubSpot will display this value as a number, making it usable in filters or API queries.For reference, three months is equal to approximately 7,888,128,000 milliseconds. How to Structure the API Query Once the field is created and populated, you can query both active subscriptions and