Navigation

Get All Users in One Project

The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

To learn how to configure API access for an Atlas project, see Configure Atlas API Access.

Info With Circle IconCreated with Sketch.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.

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

GET /groups/{PROJECT-ID}/users
Path ParameterTypeNecessityDescription
PROJECT-IDstringRequiredUnique identifier for the group.
NameTypeNecessityDescription
flattenTeamsbooleanOptional

Flag that indicates whether the returned list should include users who belong to a team that is assigned a role in this project. You might not have assigned the individual users a role in this project.

  • If this flag is set to false, the endpoint returns only users that were assigned a role in the project.
  • If this flag is set to true, the endpoint returns both users that were assigned roles in the project and users who are members of teams that were assigned roles in the project.

The default value is false.

includeOrgUsersbooleanOptional

Flag that indicates whether the returned list should include users with implicit access to the project through the Organization Owner or Organization Read Only role. You might not have assigned the individual users a role in this project.

  • If this flag is set to false, the endpoint returns only users who are assigned a role in the project.
  • If this flag is set to true, the endpoint returns both users who are assigned roles in the project and users who have implicit access to the project through their organization role.

The default value is false.

This endpoint doesn't use HTTP request body parameters.

The response JSON document includes an array of result objects, an array of link objects and a count of the total number of result objects retrieved.

NameTypeDescription
resultsarray of objectsOne object for each item detailed in the results Embedded Document section.
linksarray of objectsOne or more links to sub-resources and/or related resources. The relations between URL s are explained in the Web Linking Specification
totalCountintegerCount of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated.

Each result is one user.

Response ParameterTypeRequiredDescription
countrystringRequiredISO-3166-1 alpha 2 country code of the Atlas user's country of residence.
emailAddressstringRequiredAtlas user's email address.
firstNamestringRequiredAtlas user's first name.
idstringRequiredUnique identifier for the Atlas user.
lastNamestringRequiredAtlas user's last name.
linksarray of objectsRequiredOne or more links to sub-resources and/or related resources. The relation-types between URL s are explained in the Web Linking Specification.
mobileNumberstringRequiredAtlas user's mobile or cell phone number, if it is listed in the user's profile.
passwordstringRequired

Password. Atlas doesn't return this parameter except in response to creating a new user.

You cannot update the password via API once set. The user must log into Atlas and update their password from the Atlas console.

rolesarray of objectsRequiredEach 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.groupIdstringRequiredunique identifier of the project in which the user has the specified roles.roleName.
roles.orgIdstringRequiredunique identifier of the organization in which the user has the specified roles.roleName.
roles.roleNamestringRequired

name of the role.

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

RoleMapping
ORG_OWNEROrganization Owner
ORG_GROUP_CREATOROrganization Project Creator
ORG_BILLING_ADMINOrganization Billing Admin
ORG_READ_ONLYOrganization Read Only
ORG_MEMBEROrganization Member

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

RoleMapping
GROUP_OWNERProject Owner
GROUP_CLUSTER_MANAGERProject Cluster Manager
GROUP_READ_ONLYProject Read Only
GROUP_DATA_ACCESS_ADMINProject Data Access Admin
GROUP_DATA_ACCESS_READ_WRITEProject Data Access Read/Write
GROUP_DATA_ACCESS_READ_ONLYProject Data Access Read Only
teamIdsarray of stringsRequiredUnique identifiers for each team to which the user belongs.
usernamestringRequiredAtlas username. Must use email address formatting. You cannot modify the username once set.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--include \
--request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/users?pretty=true&includeOrgUsers=true"
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
1{
2 "links": [{
3 "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/ users?pretty=true&pageNum=1&itemsPerPage=100",
4 "rel": "self"
5 }],
6 "results": [{
7 "country" : "UK",
8 "emailAddress": "joe.bloggs@example.com",
9 "firstName": "Joe",
10 "id": "{USER-ID}",
11 "lastName": "Bloggs",
12 "links": [{
13 "href": "https://cloud.mongodb.com/api/atlas/v1.0/users/{USER-ID}",
14 "rel": "self"
15 }, {
16 "href": "https://cloud.mongodb.com/api/atlas/v1.0/users/{USER-ID}/accessList",
17 "rel": "http://mms.mongodb.com/accessList"
18 }],
19 "roles": [{
20 "groupId": "{PROJECT-ID}",
21 "roleName": "GROUP_OWNER"
22 }, {
23 "groupId": "{OTHER-PROJECT-ID}",
24 "roleName": "GROUP_OWNER"
25 }],
26 "username": "joe.bloggs"
27 }, {
28 "country" : "UK",
29 "emailAddress": "jim.bloggs@example.com",
30 "firstName": "Jim",
31 "id": "{OTHER-USER-ID}",
32 "lastName": "Bloggs",
33 "links": [{
34 "href": "https://cloud.mongodb.com/api/atlas/v1.0/users/{OTHER-USER-ID}",
35 "rel": "self"
36 }, {
37 "href": "https://cloud.mongodb.com/api/atlas/v1.0/users/{OTHER-USER-ID}/accessList",
38 "rel": "http://mms.mongodb.com/accessList"
39 }],
40 "roles": [{
41 "roleName": "GLOBAL_READ_ONLY"
42 }, {
43 "groupId": "{PROJECT-ID}",
44 "roleName": "GROUP_OWNER"
45 }, {
46 "orgId": "{ORGANIZATION-ID}",
47 "roleName": "ORG_READ_ONLY"
48 }],
49 "username": "jim.bloggs"
50 }],
51 "totalCount": 2
52}
Give Feedback