Skip to main content

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!

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


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

 
 
 

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


Thanks @David To.

Is creating segments via API on the roadmap?

Cheers…..Jim

 
 
 

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


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?


We need that too


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

 
 
 

we also need this.


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. 


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


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

 
 
 

Hey @aemery @jimk @DanErezSD @eaglepeakoutdoors, good news! We released an API for creating and updating segments. I’d recommend checking out our Segments API overview to get started. 


Excited to hear more about what you build with it!


Reply