I'm not sure I follow what you're looking for. Users, in and of themselves, do not have sub-accounts (at least as far as I know the system). They can be given an Account Role for a sub-account or enrolled in a course belonging to a sub-account. Are you trying to identify one of these? Perhaps both?
We have courses attached to Subaccounts. We add user's to those subaccounts to they can have access of varying levels to different courses. I see these - Canvas Live API , but I do not see a way in any of these to read the end user's list of subaccounts to which they belong. I can remove a user from subaccounts, I can place a user withing subaccounts...but I see no way to simply see the end user's subaccounts.
Is that clearer? Sorry it didn't make sense the first time.
Alright, so you're trying to get a list of the Account Roles a user has. This...is a bit frustrating to do, but doable.
In short, what you need to do is use the Admins API to retrieve a list of Account Roles assigned to a user. The API supports filtering by user_id, so that's relatively easy. Next, you need to use the Accounts API to retrieve a list a sub-accounts and for each of these, repeat the process, continuing until the path of sub-accounts is empty.
If you need, I can draw up a small example of how this can be done.
I programmed a way to find the subaccount admins for each subaccount, based upon my understanding of the APIs. Not sure if it is exactly like you said, but without your information and suggestion it would not have been as straightforward. I know something I didn't before Tuesday thanks to you.
Here's what I did with it, using two new URIs, after creating a new class and tweaking a couple of other classes (strARG_1 is the appropriate dynamic argument to give me the results I need -