Do you have an Audiences API?

Currently you can add, remove, and modify audiences only by using the Personas in-app audience builder.

However, you can programmatically query the Profile API in order to determine if a particular user is a member of a particular audience because Personas creates a trait with the same name as your audience. For example, to determine if the user with an email address of bob@example.com is a member of your high_value_users audience, you could query the following profile API URL:

https://profiles.segment.com/v1/namespaces/<namespace_id>/collections/users/profiles/email:bob@segment.com/traits?include=high_value_users

The following response indicates that Bob is indeed a high-value user:

{
  "traits": {
    "high_value_users": true,
  },
  "cursor": {
    "has_more": false,
  }
}

To learn more about our profile API, you can head here.


If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!