Add Users

Prev Next
Post
/api/v1/import.addUsers

Adds user data to the import staging area. It requires the current import operation status to be either new or ready. If successful, it changes the operation state to ready. Permission required: run-import

Changelog

Version Description
6.3.0 Added
Header parameters
X-User-Id
stringRequired

The user ID.

ExampleCkCPNctrgCDfmWLqC
X-Auth-Token
stringRequired

The authentication token.

Example1Dd4iN_ClKn5jl-xPC36snQ4s9Zd5GZnXCQuCNSKcVE
Body parameters

Note:

  1. A minimum of one email address and one import ID is required. If any user is missing those, the endpoint will fail and no user will be added to the operation.
  2. Emails and usernames will not be validated, but they must be unique or the user creation will fail.
  3. If roles are added, they must be valid Rocket.Chat roles, or the endpoint will fail and no user will be added to the operation.
  4. The default roles will be added to all users automatically.
  5. If no password is added, a temporary random password will be generated automatically.
  6. Users flagged as deleted will be created as Deactivated on Rocket.Chat.
  7. Avatar URLs will not be fetched automatically. The workspace administrator needs to use the Download Pending Avatars button in Administration > Workspace > Import on the workspace after the import is completed.
  8. Import IDs will not be used as IDs by Rocket.Chat, but you can query users by their import ID with the users.info.
Example
{
  "users": [
    {
      "username": "john.doe",
      "emails": [
        "[email protected]"
      ],
      "importIds": [
        "1523"
      ],
      "name": "John Doe",
      "password": "P@ssw0rd"
    },
    {
      "username": "jane.doe",
      "emails": [
        "[email protected]"
      ],
      "importIds": [
        "1524"
      ],
      "name": "Jane Doe"
    }
  ]
}
Expand All
object
users
Array of object
object
username
string

The user name.

emails
Array of string Required

The user email addresses.

string
importIds
Array of string Required

A list of IDs that can identify the user.

string
name
string

The user's display name.

password
string

A password to assign to this user.

utcOffset
number

The user's timezone, in number of hours relative to UTC.

roles
Array of string

A list of roles to assign to the user

string
type
string

The user type, must be either "user" or "bot".

bio
string

The user's profile bio.

deleted
boolean

Was the user deleted from the previous system?

avatarUrl
string

A URL pointing to the user's avatar picture.

Responses
200

OK

Success
{
  "success": true
}
object
success
boolean
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string
403

Forbidden

Permission Error
{
  "success": false,
  "error": "User does not have the permissions required for this action [error-unauthorized]"
}
object
success
boolean
error
string