Skip to main content

Do we have API to get account id by email?

  • February 23, 2024
  • 3 replies
  • 206 views

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!!

3 replies

rbarbosa Box
Forum|alt.badge.img
  • Developer Advocate
  • 556 replies
  • February 23, 2024

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


  • Author
  • New Participant
  • 2 replies
  • March 4, 2024

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 ?


rbarbosa Box
Forum|alt.badge.img
  • Developer Advocate
  • 556 replies
  • March 11, 2024

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