emails Resource

Overview

An account can have one or more email addresses associated with it. Use this end point to list, change, or create an email address. This resource has the following fields:

Field Description
active Boolean indicating the user confirmed the email address (true). While this flag is false, Bitbucket does not use the email address to do such things as linking changesets back to an account.
email The email address.
primary Boolean indicating the email is the primary (true). The primary address is the main contact email address for the account. If an account has multiple email addresses, only one address can be primary.

GET a list of user's email addresses

Gets the email addresses associated with the account. This call requires authentication. The possible return fields are the same for both individual and team accounts. This call takes the following parameters:

Parameter Required Description
accountname Yes The name of an individual or team account.
GET https://api.bitbucket.org/1.0/users/{accountname}/emails
  Click here to expand...
[
    {
        "active": true,
        "email": "2team.bb@gmail.com",
        "primary": true
    },
    {
        "active": false,
        "email": "ourteam@gmail.com",
        "primary": false
    }
]

GET an email address

Gets an individual email address associated with an account. This call requires authentication. This call takes the following parameters:

Parameter Required Description
accountname Yes The name of an individual or team account.
email_address Yes The email address to get.
GET https://api.bitbucket.org/1.0/users/{accountname}/emails/{email_address}
  Click here to expand...
{
        "active": false,
        "email": "ourteam@gmail.com",
        "primary": false
}

POST a new email address

Adds additional email addresses to an account. This call requires authentication. After an account has multiple email addresses, you can use the PUT call below to set one of the addresses to primary. This call takes the following parameters:

Parameter Required Description
accountname Yes The name of an individual or team account.
email_address Yes The email address to get.

When you add an address, Bitbucket sends an activation email to the new address. After the user clicks the activation link in the email, the address active is set to true and the address is available for use. If you make the POST call again, Bitbucket sends a new confirmation email with a new and sets the active value to false. The newly sent activation link supersedes the link in any previous emails.

Due to caching, it can take some time for all relevant pages on the site to reflect the new address.

POST https://api.bitbucket.org/1.0/users/{accountname}/emails/{email_address} --data"email=value"
  Click here to expand...
[
    {
        "active": true,
        "email": "2team.bb@gmail.com",
        "primary": true
    },
    {
        "active": false,
        "email": "ourteam@gmail.com",
        "primary": false
    }
]

Update an email address

Sets an individual email address associated with an account to primary. The primary email address is the main email contact for the account. Only a single address on an account can be primary. If another address had primary set prior to this call, after it is no longer primary. This call requires authentication and takes the following parameters:

Parameter Required Description
accountname Yes The name of an individual or team account.
email_address Yes The email address to get.
PUT https://api.bitbucket.org/1.0/users/{accountname}/emails/{email_address} --data "primary=true"
  Click here to expand...
{
        "active": true,
        "email": "ourteam@gmail.com",
        "primary": true
}

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport