Navigation

Get All Database Users

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.

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

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.

GET /groups/{GROUP-ID}/databaseUsers
Parameter
Required/Optional
Description
GROUP-ID
Required.
Unique identifier for the project.

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

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

This endpoint does not use HTTP request body parameters.

If you set the query element envelope to true, the response is wrapped by the content object.

The HTTP response returns a JSON document that includes the following objects:

An array of documents, each representing one database user.

Response Element
Type
Description
databaseName
string

The user's authentication database. A user must provide both a username and authentication database to log into MongoDB.

Returned values include:

  • $external if the user is authenticated using X.509 certificates, LDAP, or AWS IAM.
  • admin users authenticated using SCRAM-SHA.

    This is the default authentication scheme in Atlas.

deleteAfterDate
string
Timestamp in ISO 8601 date and time format in UTC after which Atlas deletes the user. This field is only present if an expiration date was specified when creating the entry.
groupId
string
Unique identifier of the Atlas project to which the user belongs.
labels
array of documents
Array containing key-value pairs that tag and categorize the database user.
ldapAuthType
string

Method by which the specified username is authenticated. If no value is given, Atlas uses the default value of NONE.

Returned values include:

NONE
Atlas authenticates this user through SCRAM-SHA, not LDAP.
USER
LDAP server authenticates this user through the user's LDAP user.
GROUP
LDAP server authenticates this user using their LDAP user and authorizes this user using their LDAP group. To learn more about LDAP security, see Set up User Authentication and Authorization with LDAP.
x509Type
string

X.509 method by which the provided username is authenticated. If no value is given, Atlas uses the default value of NONE.

The possible types are:

NONE
The user does not use X.509 authentication.
MANAGED

The user is being created for use with Atlas-managed X.509.

Externally authenticated users can only be created on the $external database.

CUSTOMER

The user is being created for use with Self-Managed X.509. Users created with this x509Type require a Common Name (CN) in the username field. To learn more, see RFC 2253.

Externally authenticated users can only be created on the $external database.

awsIAMType
string

If this value is set, the new database user authenticates with AWS IAM credentials.

Possible response values are:

NONE
The user does not use AWS IAM credentials.
USER
New database user has AWS IAM user credentials.
ROLE
New database user has credentials associated with an AWS IAM role.
links
document array
One or more links to sub-resources and/or related resources.
roles
string array

Array of this user's roles and the databases / collections on which the roles apply. A role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well.

roles
.collectionName
string
Collection on which the user has the specified role.
roles
.databaseName
string
Database on which the user has the specified role. A role on the admin database can include privileges that apply to the other databases.
roles
.roleName
string

Name of the role. The accepted values are:

scopes
array of documents
Array of clusters and Atlas Data Lakes that this user has access to. Returns an empty array if the user has access to all the clusters and Atlas Data Lakes in the project. Database users are granted access to all resources by default.
scopes.name
string
Name of the cluster or Atlas Data Lake that this user has access to.
scopes.type
string

Type of resource that this user has access to. Valid values are:

  • CLUSTER
  • DATA_LAKE
username
string

Username for authenticating to MongoDB.

A fully qualified distinguished name, as defined in RFC-2253, is returned if:

  • ldapAuthType is USER or GROUP, or
  • x509Type is CUSTOMER.

An ARN is returned if:

  • awsIAMType is USER or ROLE.

An array of documents, representing a link to one or more sub-resources and/or related resources such as list pagination. See Linking for more information.

The total number of items in the result set. This value may be higher than the number of objects in the results array if the entire result set is paginated.

Important

You must modify the following code block with the appropriate credentials and project ID.

curl -i -u "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest "https://cloud.mongodb.com/api/atlas/v1.0/groups/5356823b3794dee37132bb7b/databaseUsers?pretty=true"
HTTP/1.1 200 OK
{
"links" : [ ... ],
"results" : [
{
"databaseName" : "admin",
"groupId" : "5356823b3794dee37132bb7b",
"labels" : [],
"links" : [ ... ],
"roles" : [ {
"databaseName" : "staging",
"roleName" : "readWrite"
}, {
"databaseName" : "production",
"roleName" : "read"
} ],
"scopes": [],
"username" : "susan"
},
...
],
"totalCount" : 4
}
Give Feedback