Navigation

Users

Endpoints

Get a User by ID

To retrieve the USER-ID for a user, see Get All Users in a Group.

GET /api/public/v1.0/users/USER-ID

You can always retrieve your own user account. Otherwise, you must have the user admin role in at least one group that is common between you and the user you are retrieving.

Get a User by Name

GET /api/public/v1.0/users/byName/USER-NAME

You can always retrieve your own user account. Otherwise, you must have the user admin role in at least one group that is common between you and the user you are retrieving.

Create a User

Create a new user. All fields are required.

POST /api/public/v1.0/users

Update a User

Update an existing user using the fields provided. Unspecified fields will preserve their current values. You cannot specify the password for security reasons.

PATCH /api/public/v1.0/users/USER-ID

Sample Entity

{
  "id": "xxx",
  "username": "somebody",
  "password": "abc123",
  "emailAddress": "somebody@qa.example.com",
  "mobileNumber": "2125551234",
  "firstName": "John",
  "lastName": "Doe",
  "roles": [
      {
        "groupId": "8491812938cbda83918c",
        "roleName": "GROUP_OWNER"
      },
      {
        "groupId": "4829cbda839cbdac3819",
        "roleName": "GROUP_READ_ONLY"
      }
  ],
  "links": [ ... ]
}

Entity Fields

Name Type Description
id string Unique identifier.
username string Cloud Manager username.
password string Password. This field is NOT included in the entity returned from the server. It can only be sent in the entity body when creating a new user.
emailAddress string Email address.
mobileNumber string Mobile number.
firstName string First name.
lastName string Last name.
roles object array Role assignments.
roles.groupId string The group ID in which the user has the specified role. Note that for the “global” roles (those whose name starts with GLOBAL_) there is no groupId since these roles are not tied to a group.
roles.roleName string

The name of the role. The users resource returns all the roles the user has in both Cloud Manager and MongoDB Atlas. Possible values are:

  • GROUP_AUTOMATION_ADMIN
  • GROUP_BACKUP_ADMIN
  • GROUP_BILLING_ADMIN
  • GROUP_MONITORING_ADMIN
  • GROUP_OWNER
  • GROUP_READ_ONLY
  • GROUP_USER_ADMIN
  • GROUP_DATA_ACCESS_ADMIN

Examples

Get a User by ID

Request

curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/users/533dc19ce4b00835ff81e2eb"

Response

HTTP/1.1 200 OK

{
  "id" : "533dc19ce4b00835ff81e2eb",
  "username" : "jane",
  "emailAddress" : "jane@qa.example.com",
  "firstName" : "Jane",
  "lastName" : "D'oh",
  "roles" : [ {
    "groupId" : "533daa30879bb2da07807696",
    "roleName" : "GROUP_USER_ADMIN"
  } ],
  "links": [ ... ]
}

Get a User by Name

Request

curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/users/byName/jane"

Response

HTTP/1.1 200 OK

{
  "emailAddress" : "jane@qa.example.com",
  "firstName" : "Jane",
  "id" : "533dc19ce4b00835ff81e2eb",
  "lastName" : "D'oh",
  "roles" : [ {
    "groupId" : "533daa30879bb2da07807696",
    "roleName" : "GROUP_USER_ADMIN"
  } ],
  "links": [ ... ]
}

Get All Users in a Group

Request

curl -u "username:apiKey" --digest -i "https://cloud.mongodb.com/api/public/v1.0/groups/533daa30879bb2da07807696/users"

Response

HTTP/1.1 200 OK

{
  "totalCount": 3,
  "results": [ {
    "id" : "5329c8dfe4b0b07a83d67e7d",
    "username" : "jdoe",
    "emailAddress" : "jdoe@example.com",
    "firstName" : "John",
    "lastName" : "Doe",
    "roles" : [ {
      "groupId" : "5329cb6e879bb2da07806511",
      "roleName" : "GROUP_OWNER"
    }, {
      "groupId" : "5196d3628d022db4cbc26d9e",
      "roleName" : "GROUP_READ_ONLY"
    }, {
      "groupId" : "533daa30879bb2da07807696",
      "roleName" : "GROUP_READ_ONLY"
    } ],
    "links": [ ... ]
  }, {
    // etc.
  } ],
  "links": [ ... ]
}

Create a User

Request

curl -u "username:apiKey" -H "Content-Type: application/json" --digest -i -X POST "https://cloud.mongodb.com/api/public/v1.0/users" --data '
{
  "username": "jane",
  "emailAddress": "jane.doe@mongodb.com",
  "firstName": "Jane",
  "lastName": "Doe",
  "password": "M0ng0D8!:)",
  "roles": [{
    "groupId": "533daa30879bb2da07807696",
    "roleName": "GROUP_USER_ADMIN"
  }]
}'

Response

HTTP/1.1 201 Created

{
  "id" : "533dc19ce4b00835ff81e2eb",
  "username" : "jane",
  "emailAddress" : "jane.doe@mongodb.com",
  "firstName" : "Jane",
  "lastName" : "Doe",
  "roles" : [ {
    "groupId" : "533daa30879bb2da07807696",
    "roleName" : "GROUP_USER_ADMIN"
  } ],
  "links" : [ ... ]
}

Update a User

Request

curl -u "username:apiKey" -H "Content-Type: application/json" --digest -i -X PATCH "https://cloud.mongodb.com/api/public/v1.0/users/533dc19ce4b00835ff81e2eb" --data '
{
  "emailAddress": "jane@qa.example.com",
  "lastName": "D'oh"
}'

Response

HTTP/1.1 200 OK

{
  "id" : "533dc19ce4b00835ff81e2eb",
  "username" : "jane",
  "emailAddress" : "jane@qa.example.com",
  "firstName" : "Jane",
  "lastName" : "D'oh",
  "roles" : [ {
    "groupId" : "533daa30879bb2da07807696",
    "roleName" : "GROUP_USER_ADMIN"
  } ],
  "links" : [ ... ]
}
←   Delete a Group Whitelist  →