Solved

How to sort/filter/paginate members list from a particular group using the API

  • 1 October 2021
  • 2 replies
  • 67 views

Badge

I’m trying to use the API to retrieve all the recently created users from a List but I’m not able to find any method for that. 

For example, I want to retrieve the latests members that were added into that list that includes an specific custom property. 

The closest one is the list-segments endpoints https://apidocs.klaviyo.com/reference/lists-segments#get-members but does not alows any filltering/sorting capabilities. 

There is any way I can do that with the current API versions?

Thanks in advance,

Nico

icon

Best answer by David To 4 October 2021, 17:15

View original

2 replies

Userlevel 7
Badge +48

Hello @ngerolami,

Thanks for sharing your question with the Klaviyo Community!

The current Klaviyo API versions do not allow creating segments via API. I’ll certainly share your use case and feedback with our Product Team to explore more on this function!

You are certainly on the right track of utilizing the Get List and Segment Members endpoint to return members of a list or segment. However, in order to do so you’ll first need to create the segment within the Klaviyo UI which would return a list of contacts who are in a specific list who has the specific profile property you are parsing for. With the segment created, you can either review the members of the segment within the Klaviyo UI, export the segment as a .CSV to review, or use the Get List and Segment Members endpoint to return the list via API. 

A segment definition you can use for this would be “If someone is or is not in a list, Person is in X list AND Properties about someone, Custom Profile Property equals X”. Additionally, you can add more definitions to this rule to further drill down and filter for your desired profiles.

Thanks for being a part of the Klaviyo Community!

David

Badge

David, thanks for your Answer, I’ll try that and see if that helps. 

Regards

Reply