Create email alias

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

Adds a new email alias to a user account..

Request

application/json

Path Parameters

stringin pathrequired
12345

The ID of the user.

Request Body

stringin bodyrequired
alias@example.com

The email address to add to the account as an alias.

Response

application/jsonEmail alias

Returns the newly created email alias object.

application/jsonClient error

An unexpected client error.

post
Create email alias
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -X POST https://api.box.com/2.0/users/12345/email_aliases \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
     -H 'Content-Type: application/json" '
     -d '{
       "email": "alias@example.com"
     }'
.NET
BoxEmailAlias alias = await client.UsersManager
    .AddEmailAliasAsync(userId: "33333", email: "user+foo@example.com");
Java
BoxUser user = new BoxUser(api, "0");
user.addEmailAlias("user+alias@example.com");
Python
user_id = '33333'
user = client.user(user_id)
email_alias = user.add_email_alias('alias@example.com')
Node
client.users.addEmailAlias('33333', 'user+baz@example.com')
    .then(alias => {
        /* alias -> {
            type: 'email_alias',
            id: '12345',
            is_confirmed: false,
            email: 'user+baz@example.com' }
        */
    });
iOS
client.users.createEmailAlias(
    userId: "33333",
    email: "user+alias@example.com"
) { (result: Result<EmailAlias, BoxSDKError>) in
    guard case let .success(alias) = result else {
        print("Error adding email alias")
        return
    }

    print("Added email alias \(alias.email) — user must confirm")
}