Skip to main content
Question

API : How can I get Audiences for 1 User (was easy with groups)

  • September 16, 2024
  • 4 replies
  • 167 views

When we used ‘groups’ we could easily find out which ‘groups’ an individual user was in, via the API call:

     GET /manage/v1/user/{userid}/groups

This would tell me which groups this individual user was a member of.

How can I do the same thing with Audiences?? (since the change to ‘audiences’ and the removal of ‘groups’)

The only way I see is to get a list of ALL Audiences, then call the API repeatedly for each Audience to get ALL members of each Audience (veeerrrrryyyy sssllloooooowww)

Anyone have a better idea? It seems like ‘groups’ have been removed but the equivalent facilities are not being offered for audiences.

Many Thanks

4 replies

KMallette
Hero I
Forum|alt.badge.img+11
  • Hero I
  • September 16, 2024

Hello @ianl … Are you needing this information for true machine to machine scripting, or just as an alternative approach to get information as an administrator?  If machine-to-machine, I agree that I don’t think you can do it, which is quite sad.

If you are just looking to find information as an administrator, would this work?

 


  • Author
  • Newcomer
  • September 16, 2024

Thanks @Kmallette, I wanted this for machine-to-machine communication - we have a separate software system which we are trying to link to Docebo, to allow users to manage their staff just through our interface instead of 2 separate UIs.

I am thinking the only way to do this is:

       GET /manage/v1/user/{userid}/groups

and GET /audeinces/v1/audience

and GET /manage/v1/group

This will get all the audience names and ids, and all group names and ids, then I can match them on names - this would give me the Audience IDs of all the ‘groups’ that the user belongs to.

BUT I guess this will only work until the ‘groups’ api endpoint is removed. It is still working on the platform I am using, so maybe they are on an old version (on the API Deprecated calls page it says groups were removed in Jan 2024)


Hi ​@ianl  - were you able to find an API endpoint that returned all the audiences associated with a user ID?  I’ve been looking, but I am thinking there isn’t one.


Moshe.Machlav
Helper III
Forum|alt.badge.img+2

Hi ​@Elaine_Barnes  and ​@ianl ,

You’re spot on, there isn't a direct GET /audiences/v1/user/{user_id} endpoint right now, and looping through every single audience to check membership is an absolute API performance killer.

The good news? You don’t have to do that. You can easily bypass this by leveraging Docebo’s background compatibility layer. Under the hood, Docebo still maps every single Audience to a legacy Group ID (a "shadow group") to keep core platform permissions running.

Instead of scraping everything, you can use this quick 2-step workaround:

  1. Get the User's Groups: Call the legacy endpoint GET /manage/v1/user/{userid}/groups. Even though the UI emphasizes Audiences, this endpoint is fully active and will instantly return the Group IDs this specific user belongs to.

  2. Translate to Audiences: Take those Group IDs and pass them into the cross-reference endpoint: GET /audiences/v1/audience/{id}/group_to_audience (where {id} is the integer Group ID). This will immediately return the corresponding Audience UUID.

An architectural tip from the field: When building machine-to-machine syncs with Docebo for similar tech stacks, relying on heavy real-time API polling for user assignments often creates latency bottlenecks. The pattern that holds up best over time is handling this asynchronously—either caching these mappings in your external database or using Docebo Connect to capture user profile updates via webhooks as they happen.

You can check out the official breakdown of how these ID mappings behave behind the scenes in the Docebo Developer Portal.

Hope this saves you some major scripting loops!