Navigation

Get an Atlas User by Name

The following resource returns the unique ID associated with a Atlas user account.

The Atlas API uses HTTP Digest Authentication. Provide your Atlas username and API key as the username and password when constructing the HTTP request.

For complete documentation on configuring API access for an Atlas project, see Configure Atlas API Access.

Base URL: https://cloud.mongodb.com/api/atlas/v1.0

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID. For existing groups, your group/project ID remains the same. The resource and corresponding endpoints use the term groups.

Syntax

GET /users/byName/{USER-NAME}

Request Path Parameters

Path Element Required/Optional Description
{USER-NAME} Required The Atlas user name. Must match the username provided as part of the HTTP Digest Authentication API request component.

Request Query Parameters

This endpoint may use any of the HTTP request query parameters available to all Atlas API resources. These are all optional.

Name Type Description Default
pretty boolean Display response in a prettyprint format. false
envelope boolean Specifies whether or not to wrap the response in an envelope. false

Request Body Parameters

This endpoint does not use HTTP request body parameters.

Response

The HTTP document contains each of the following elements:

Name Type Description
emailAddress string The Atlas user’s email address.
firstName string The Atlas user’s first name.
id string Unique identifier for the Atlas user.
lastName string The Atlas user’s last name.
links object array One or more links to sub-resources and/or related resources. The relation-types between URLs are explained in the Web Linking Specification.
mobileNumber string The Atlas user’s mobile or cell phone number.
roles object array Each object in the array represents either an Atlas organization or project the Atlas user is assigned to and the Atlas role has for the associated organization or project. You can specify either roles.orgId or roles.groupId per object.
roles.orgId string The unique identifier of the organization in which the user has the specified roles.roleName.
roles.groupId string The unique identifier of the project in which the user has the specified roles.roleName.
roles.roleName string

The name of the role.

When associated to roles.orgId, the valid roles and their mappings are:

When associated to roles.groupId, the valid roles and their mappings are:

teamIds array Array of string IDs for each team the user is a member of.
username string The Atlas username. Must use e-mail address formatting. You cannot modify the username once set.

Example Request

curl --user "john.doe@example.com:{apiKey}" --digest --include \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --request GET "https://cloud.mongodb.com/api/atlas/v1.0/users/byName/john.doe@example.com"

Example Response

{
    "emailAddress": "john.doe@example.com",
    "firstName": "John",
    "id": "5af1c27a0a7fa48c76d3a761",
    "lastName": "Doe",
    "links": [
        {
            "href": "https://cloud.mongodb.com/api/atlas/v1.0/users/5af1c27a0a7fa48c76d3a761",
            "rel": "self"
        },
        {
            "href": "https://cloud.mongodb.com/api/atlas/v1.0/users/5af1c27a0a7fa48c76d3a761/whitelist",
            "rel": "http://mms.mongodb.com/whitelist"
        }
    ],
    "mobileNumber" : "2125550198",
    "roles": [
        {
            "orgId": "5af1c27a0a7fa48c76d3a762",
            "roleName": "ORG_OWNER"
        },
        {
            "groupId": "5af1c27a0a7fa48c76d3a763",
            "roleName": "GROUP_OWNER"
        }
    ],
    "teamIds": [
        "5af1c27a0a7fa48c76d3a764"
    ],
    "username": "john.doe@example.com"
}