APIs & Integrations

bao
Member

Create Filter with custom date property on list api

How do I create a filter on a list using a custom date property using the between filter?

When I'm using the list creator in the hubspot UI, it sends this information:

property: "(propertyName)"
filterFamily: "PropertyValue"
highValue: "1538351999999"
longValue: 1530403200000
operator: "BETWEEN"
strValue: "1530403200000"
type: "date"
withinLastTimeMode: "PAST"

However, if I try to post that to the the api, I get a 400 error:

I also noticed that the operator: "BETWEEN" isn't documented on this page:

Create a new contact list | Contact Lists API

POST /contacts/v1/lists

0 Upvotes
2 Replies 2
AChong1
Contributor

Create Filter with custom date property on list api

Any idea what's the filter for after x number of days or similar. I couldn't get this filter to work: 

 

{"property":"notes_last_updated","operator":"IS_MORE_THAN_X_DAYS_AGO","value":"1 DAY","type":"datetime-rolling

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Create Filter with custom date property on list api

Hi @bao,

I'm not able to reproduce this on my end. The following request body creates an active list, with a date range filter from 8/01 to 8/08:

{
    "name": "Test Date Range Via API List",
    "dynamic": true,
    "portalId": 1234567,
    "filters": 
    [
        [{
            "operator": "BETWEEN",
            "value": 1533081600000,
            "highValue" : 1533772799999,
            "property": "test_date_property",
            "type": "date"
        }]
    ]
}
0 Upvotes