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

9 replies

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 +3

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 +59

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 +3

Thanks @David To.

Is creating segments via API on the roadmap?

Cheers…..Jim

 
 
 
Userlevel 7
Badge +59

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

Userlevel 2
Badge +3

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 +3

We need that too

Userlevel 2
Badge +3

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

 
 
 

Reply