Skip to main content

Hello everyone,

I am using customer io post customers api to get the users from customer io and also adding the filters to get the relevent data that matches the conditions in the filtere, but it seems to be not working.

here is the snippet of code I am using to get the data

    url = "https://api-eu.customer.io/v1/customers"
    payload = {
        "filter": {
            "and":
                {"attribute": {"field": "email", "operator": "exists", "value": False}}
            ]
        }
    }

I want users who don’t have the email attribute in their user attributes, but I am getting users with email attributes, means the filter is not working.

would appreciate the help from the community here.

Thanks

Hi there,

 

Byron here from the technical support team. Great question!

 

Our getPeopleFilter endpoint includes a not filter that accepts a single object as a way to return matches that do not match the object filter.

https://customer.io/docs/api/app/?region=eu#operation/getPeopleFilter

 

To return a list of people who do not have an email attribute, try this:

```

{
  "filter": {
    "not": 
      {
        "attribute": {
          "field": "email",
          "operator": "exists"
        }
      }
    
  }
}

```

 


Reply