N8n and segments

I’m trying to use n8n to pull a list of contacts. I’ve tried 2 ways…using a filter to search first if contact is on a specific list and second if a custom date field is within 120 of current date…second method was using a direct api call to retrieve a segment using:

get https://{youraccountname}.api-us1.com/api/3/segments/{id}

but for the life of me I cannot figure out how to get the segment ID…so then I tried using

https://{youraccountname}.api-us1.com/api/3/segments

to get a list of segments…but that didn’t even return a list of my segments…i’m not sure what it returned…a bunch of segments with random names that aren’t even in my Segements are of my AC app.

Can someone help me figure out how to find the segment ID? I’ve searched the web…can’t figure it out.

Hi Tracy!

I would suggest Finding Segment ID in the ActiveCampaign Interface - the easiest way is to grab it directly from your ActiveCampaign dashboard:

  1. Go to Contacts > Segments in your ActiveCampaign account
  2. Click on the segment you want to use
  3. Look at the URL in your browser - it should look something like: https://youraccountname.activehosted.com/app/segments/123
  4. The number at the end (123 in this example) is your segment ID

For your n8n workflow: Once you have the segment ID, your original approach should work:

GET https://{youraccountname}.api-us1.com/api/3/segments/{id}/contacts

This will give you the contacts in that specific segment.

I hope this helps!