User email addresses API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

Use this API to interact with email addresses for user accounts. For more information, see User account.

List all email addresses

Lists all email addresses for your user account.

Prerequisites:

  • You must be authenticated.
GET /user/emails

Example response:

[
  {
    "id": 1,
    "email": "email@example.com",
    "confirmed_at" : "2021-03-26T19:07:56.248Z"
  },
  {
    "id": 3,
    "email": "email2@example.com",
    "confirmed_at" : null
  }
]

List all email addresses for a user

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated

Lists all email addresses for a given user account.

Prerequisites:

  • You must have administrator access to the instance.
GET /users/:id/emails

Supported attributes:

Attribute Type Required Description
id integer yes ID of user account

Get details on an email address

Gets details on a given email address for your user account.

GET /user/emails/:email_id

Supported attributes:

Attribute Type Required Description
email_id integer yes ID of email address

Example response:

{
  "id": 1,
  "email": "email@example.com",
  "confirmed_at" : "2021-03-26T19:07:56.248Z"
}

Add an email address

Adds an email address for your user account.

POST /user/emails

Supported attributes:

Attribute Type Required Description
email string yes Email address
{
  "id": 4,
  "email": "email@example.com",
  "confirmed_at" : "2021-03-26T19:07:56.248Z"
}

Returns a created email with status 201 Created on success. If an error occurs a 400 Bad Request is returned with a message explaining the error:

{
  "message": {
    "email": [
      "has already been taken"
    ]
  }
}

Add an email address for a user

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated

Adds an email address for a given user account.

Prerequisites:

  • You must have administrator access to the instance.
POST /users/:id/emails

Supported attributes:

Attribute Type Required Description
id string yes ID of user account
email string yes Email address
skip_confirmation boolean no Skip confirmation and assume email is verified. Possible values: true, false. Default value: false.

Delete an email address

Deletes an email address for your user account. You cannot delete a primary email address.

Any future emails sent to the deleted email address are sent to the primary email address instead.

Prerequisites:

  • You must be authenticated.
DELETE /user/emails/:email_id

Supported attributes:

Attribute Type Required Description
email_id integer yes ID of email address

Returns:

  • 204 No Content if the operation was successful.
  • 404 if the resource was not found.

Delete an email address for a user

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated

Deletes an email address for a given user account. You cannot delete a primary email address.

Prerequisites:

  • You must have administrator access to the instance.
DELETE /users/:id/emails/:email_id

Supported attributes:

Attribute Type Required Description
id integer yes ID of user account
email_id integer yes ID of email address