Do we have API to get account id by email?

i am try to do some action in box , like add new task , get comments etc …
i only know the user email but in api side we need account id ,
so do we have API to get account id by email ?
or the api can using email to repacle account id ?

BTW , i am using box-python-sdk-main , thank you!!

Hi Paul,

You should be able to query the enterprise uses, if you get an invalid scope error, then you need to adjust your application configurations. Check the App+Enterprise Access in the App access level, and eventually the manage users under application scopes.

You can check an SDK example here.

For more details, check the list enterprise users end point details.

Let us know if this helps

Cheers

Hi Rui ,
list enterprise user, will get all the user list , right ? if return list is so large , that is will impact performance , like my enterprise have 10W+ user ,
do we have another API can return box user id by email ?

Hi @user159

You can filter using the /users end point. For example:

curl --location 'https://api.box.com/2.0/users?filter_term=rui&user_type=managed&fields=id%2Ctype%2Cname' \
--header 'Authorization: Bearer 1!5...10.' \

Will return:

{
    "total_count": 1,
    "entries": [
        {
            "type": "user",
            "id": "18622116055",
            "name": "Rui Barbosa"
        }
    ],
    "limit": 100,
    "offset": 0
}

The filter term limits the results to only users who’s name or login start with the search term.
For externally managed users, the search term needs to completely match the in order to find the user, and it will only return one user at a time.

Let us know if this helps.

Cheers