Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

List user's email aliases

get
https://api.box.com/2.0
/users/:user_id/email_aliases

Retrieves all email aliases for a user. The collection does not include the primary login for the user.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The ID of the user.

Response

application/jsonEmail aliases

Returns a collection of email aliases.

application/jsonClient error

An unexpected client error.

get
List user's email aliases
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X GET "https://api.box.com/2.0/users/12345/email_aliases" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.emailAliases.getUserEmailAliases(newUser.id);
Python Gen
client.email_aliases.get_user_email_aliases(new_user.id)
.NET Gen
await client.EmailAliases.GetUserEmailAliasesAsync(userId: newUser.Id);
Swift Gen (Beta)
try await client.emailAliases.getUserEmailAliases(userId: newUser.id)
Java
BoxUser user = new BoxUser(api, "0");
Collection<EmailAlias> emailAliases = user.getEmailAliases();
Python
user_id = '33333'
user = client.user(user_id)
email_aliases = user.get_email_aliases()
for alias in email_aliases:
    print(f'User {user.id} has email alias {alias.email}')
.NET
BoxCollection<BoxEmailAlias> aliases = await client.UsersManager
    .GetEmailAliasesAsync(userId: "33333");
Node
client.users.getEmailAliases('33333')
    .then(emailAliases => {
        /* emailAliases -> {
            total_count: 2,
            entries: 
            [ { type: 'email_alias',
                id: '1234',
                is_confirmed: true,
                email: 'user+foo@example.com' },
                { type: 'email_alias',
                id: '1235',
                is_confirmed: true,
                email: 'user+bar@example.com' } ] }
        */
    });
iOS
client.users.listEmailAliases(userId: "33333") { (result: Result<EntryContainer<User>, BoxSDKError>) in
    guard case let .success(aliasCollection) = result else {
        print("Error retrieving email aliases")
        return
    }

    print("User has \(aliasCollection.totalCount) email aliases:")
    for alias in aliasCollection.entries {
        print("- \(alias.email) (\(alias.isConfirmed ? "Confirmed" : "Not Confirmed"))")
    }
}

Response Example

{
  "entries": [
    {
      "id": "11446498",
      "type": "email_alias",
      "email": "alias@example.com",
      "is_confirmed": true
    }
  ],
  "total_count": 5000
}