Solved

Create segment via API


Badge +1

Does anyone know of a way to create a segment via API? Im trying to automate creating a segment to contain all profiles in the account. There is an endpoint to create a list through the API, but I cant find an endpoint to create a segment.

The reason I ask here is because I have noticed that there there are API endpoints that exist but are not included in the documentation. Possibly because they have been deprecated.

If anyone has any input here it would be much appreciated! Thanks!

icon

Best answer by alex.hong 28 May 2022, 01:27

View original

14 replies

Userlevel 7
Badge +36

Hi @DanErezSD!

I will definitely forward this sentiment to our product team for consideration in future releases!

Best,

Brian

Joining my voice to this request if it can help move it forward. We would also have a use case for a create segment API endpoint. Lists will work for now, but it means that we need a dev from the team to build a feature to dynamically add and remove profiles from the list where as segments would allow our marketing team to be self-sufficient in the work. And since the number of segment is too large to me manageable manually, we would really need an API to automate their creation.

 

Cheers,

Alex

Userlevel 2
Badge +4

Thanks again David.

I know it might not be practical, but we have a specific need/use-case and it would be very useful.  We have a workaround for now.  

Cheers….Jim

 
 
 

@jimk very interested to hear your workaround as we also need a create-segment endpoint. Would you mind sharing it?

Badge +4

We need that too

Badge +1

we also need this.

Badge +1

the issue with a a list that you automatically update is that once you hit 10K plus users it just takes for ever to do any sort of ops. 

I don’t see why a json or some SQL like statment can’t define the same or.and conditions as what the website allows. 
i’ts actually very programatically friendly and fully defined as is. 

Userlevel 2
Badge +4

Hi @jaco5842 and @lonsilon.

Sorry for the tardy reply.  Just back from holidays.  
I’m not the dev on our team, so my explanation may not be technically correct. The gist of our workaround is to dynamically create a ‘list’ and programmatically (based on our criteria) select which profiles will be added to that list.  Hope this helps.

Cheer...Jim

 
 
 
Userlevel 7
Badge +58

Hi there @eaglepeakoutdoors,

Thanks for posting to the Community.

There is no API endpoint to create a Segment. You can only create Segments in the Klaviyo dashboard since it involves making definitions. In terms of what you can achieve, we have a developer doc with explanations.

 

Apologies for the inconvenience,

Alex

Userlevel 2
Badge +4

Agree Alex.  What you describe is what we’re doing now with lists.  A create segment API is going to be a much better solution.  Can’t wait to roll up our sleeves and dive into this.

Cheers…..Jim

 
 
 
Userlevel 2
Badge +4

Good day.  By chance is there an update on this since the original post?  If I know the segment definitions in advance is it now possible to create and segment via API?

Thanks…..Jim

 
 
 
Userlevel 7
Badge +60

Hello @jimk,

As part of our new API, we do have an endpoint for segments now. However, this endpoint is meant for retrieving the segment and profiles associated with them.

Currently, it’s still not supported to create segments via API. 

You can find more information on our segment endpoint from our API Reference here

David

Userlevel 2
Badge +4

Thanks @David To.

Is creating segments via API on the roadmap?

Cheers…..Jim

 
 
 
Userlevel 7
Badge +60

Hey @jimk,

I’m unsure if creating segments via API is on our roadmap or not. I’ll certainly share this feedback with our Product Team - especially the ones responsible for the rollout of our new API to explore this further.

David

Reply