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/{GROUP-ID}/users
Path Parameter
Type
Necessity
Description
GROUP-ID
string
Required
Unique identifier for the group.
Name
Type
Necessity
Description
Default
pageNum
integer
Optional
Page number, starting with one, that Atlas returns of the total number of objects.
1
itemsPerPage
integer
Optional
Number of items that Atlas returns per page, up to a maximum of 500.
100
includeCount
boolean
Optional
Flag that indicates whether Atlas returns the totalCount parameter in the response body.
true
pretty
boolean
Optional
Flag that indicates whether Atlas returns the JSON response in the prettyprint format.
false
envelope
boolean
Optional

Flag that indicates whether Atlas wraps the response in an envelope.

Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

Endpoints that return a list of results use the results object as an envelope. Atlas adds the status parameter to the response body.

false
flattenTeams
boolean
Optional

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.
false
includeOrgUsers
boolean
Optional

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.
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.

Name
Type
Description
results
array of objects
One object for each item detailed in the results Embedded Document section.
links
array of objects

One or more links to sub-resources and/or related resources. The relations between URL s are explained in the Web Linking Specification

totalCount
integer
Count 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 Parameter
Type
Required
Description
country
string
Required
ISO-3166-1 alpha 2 country code of the Atlas user's country of residence.
emailAddress
string
Required
Atlas user's email address.
firstName
string
Required
Atlas user's first name.
id
string
Required
Unique identifier for the Atlas user.
lastName
string
Required
Atlas user's last name.
links
array of objects
Required

One or more links to sub-resources and/or related resources. The relation-types between URL s are explained in the Web Linking Specification.

mobileNumber
string
Required
Atlas user's mobile or cell phone number, if it is listed in the user's profile.
password
string
Required

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.

roles
array of objects
Required
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.groupId
string
Required
unique identifier of the project in which the user has the specified roles.roleName.
roles.orgId
string
Required
unique identifier of the organization in which the user has the specified roles.roleName.
roles.roleName
string
Required

name of the role.

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

Role
Mapping
ORG_OWNER
ORG_GROUP_CREATOR
ORG_BILLING_ADMIN
ORG_READ_ONLY
ORG_MEMBER

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

Role
Mapping
GROUP_OWNER
GROUP_CLUSTER_MANAGER
GROUP_READ_ONLY
GROUP_DATA_ACCESS_ADMIN
GROUP_DATA_ACCESS_READ_WRITE
GROUP_DATA_ACCESS_READ_ONLY
teamIds
array of strings
Required
Unique identifiers for each team to which the user belongs.
username
string
Required
Atlas 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/{GROUP-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/{GROUP-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": "{GROUP-ID}",
21 "roleName": "GROUP_OWNER"
22 }, {
23 "groupId": "{OTHER-GROUP-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": "{GROUP-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