Create a user

POST /groups/{groupId}/apps/{appId}/users

Create a new email/password user account.

Note: You cannot create user accounts through the Admin API for any authentication provider other than email/password.

Path parameters

application/json

Body Required

The user to create

  • email string Required
  • password string Required

Responses

  • 201 application/json

    Successfully created.

    Hide response attributes Show response attributes object
    • _id string

      The unique user account ID

    • identities array[object]

      A list of authentication provider identities associated with the user account.

      An authenticated identity from an authentication provider. This represents the user account within an individual auth provider and maps the account to external authentication systems.

      Hide identities attributes Show identities attributes object
      • id string
      • provider_type string

        Values are anon-user, local-userpass, api-key, oauth2-apple, oauth2-google, oauth2-facebook, custom-token, or custom-function.

      • provider_id string
    • type string

      The user type. Most users are normal and represent a specific human user. Users created through the api-key provider have the type server because they are typically used for programmatic access from a server.

      Values are normal or server.

    • creation_date integer

      The date and time that the user account was created. Represented by the number of seconds since the UNIX epoch.

    • last_authentication_date integer

      The date and time that the user account last logged in or authenticated a request. Represented by the number of seconds since the UNIX epoch.

    • disabled boolean

      If true, the user account is inactive and cannot login or interact with App Services.

    • data object

      Metadata that describes the user. This field combines the data for all authentication identities associated with the user. The exact field names and values depend on which authentication providers the user has authenticated with.

      For example, if a user has linked an email/password account with their Google account, this object might contain their email as well as metadata fields from Google like name and picture.

POST /groups/{groupId}/apps/{appId}/users
curl \
 --request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/users' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"email":"string","password":"string"}'
Request examples
{
  "email": "string",
  "password": "string"
}
Response examples (201)
{
  "_id": "string",
  "identities": [
    {
      "id": "string",
      "provider_type": "anon-user",
      "provider_id": "string"
    }
  ],
  "type": "normal",
  "creation_date": 42,
  "last_authentication_date": 42,
  "disabled": true,
  "data": {}
}