> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Users

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

## OpenAPI

````json POST /api/v1/import.addUsers
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Settings"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "paths": {
    "/api/v1/import.addUsers": {
      "parameters": [],
      "post": {
        "summary": "Add Users",
        "operationId": "post-api-v1-import.addUsers",
        "responses": {
          "200": {
            "$ref": "#/components/responses/trueSuccess"
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          },
          "403": {
            "$ref": "#/components/responses/forbiddenError"
          }
        },
        "description": "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`.\nPermission required: `run-import`\n### Changelog\n| Version      | Description |\n| ---------------- | ------------|\n|6.3.0            | Added       |",
        "parameters": [
          {
            "$ref": "#/components/parameters/X-User-Id"
          },
          {
            "$ref": "#/components/parameters/X-Auth-Token"
          }
        ],
        "tags": [
          "Bulk User Import"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "users": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "username": {
                          "type": "string",
                          "description": "The user name."
                        },
                        "emails": {
                          "type": "array",
                          "description": "The user email addresses.",
                          "items": {
                            "type": "string"
                          }
                        },
                        "importIds": {
                          "type": "array",
                          "description": "A list of IDs that can identify the user.",
                          "items": {
                            "type": "string"
                          }
                        },
                        "name": {
                          "type": "string",
                          "description": "The user's display name."
                        },
                        "password": {
                          "type": "string",
                          "description": "A password to assign to this user."
                        },
                        "utcOffset": {
                          "type": "number",
                          "description": "The user's timezone, in number of hours relative to UTC."
                        },
                        "roles": {
                          "type": "array",
                          "description": "A list of roles to assign to the user",
                          "items": {
                            "type": "string"
                          }
                        },
                        "type": {
                          "type": "string",
                          "description": "The user type, must be either \"user\" or \"bot\"."
                        },
                        "bio": {
                          "type": "string",
                          "description": "The user's profile bio."
                        },
                        "deleted": {
                          "type": "boolean",
                          "description": "Was the user deleted from the previous system?"
                        },
                        "avatarUrl": {
                          "type": "string",
                          "description": "A URL pointing to the user's avatar picture."
                        }
                      },
                      "required": [
                        "emails",
                        "importIds"
                      ]
                    }
                  }
                }
              },
              "examples": {
                "Example": {
                  "value": {
                    "users": [
                      {
                        "username": "john.doe",
                        "emails": [
                          "john.doe@example.com"
                        ],
                        "importIds": [
                          "1523"
                        ],
                        "name": "John Doe",
                        "password": "P@ssw0rd"
                      },
                      {
                        "username": "jane.doe",
                        "emails": [
                          "jane.doe@example.com"
                        ],
                        "importIds": [
                          "1524"
                        ],
                        "name": "Jane Doe"
                      }
                    ]
                  }
                }
              }
            }
          },
          "description": "Note:\n  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.\n  2. Emails and usernames will not be validated, but they must be unique or the user creation will fail.\n  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.\n  4. The default roles will be added to all users automatically.\n  5. If no password is added, a temporary random password will be generated automatically.\n  6. Users flagged as `deleted` will be created as `Deactivated` on Rocket.Chat.\n  7. Avatar URLs will not be fetched automatically. The workspace administrator needs to use the **Download Pending Avatars** button in **Manage** > **Workspace** > **Import** on the workspace after the import is completed.\n  8. Import IDs will not be used as IDs by Rocket.Chat, but you can query users by their import ID with the  <a href=\"https://developer.rocket.chat/apidocs/get-users-info\" target=\"_blank\">users.info</a>."
        }
      }
    }
  },
  "components": {
    "responses": {
      "trueSuccess": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                }
              }
            },
            "examples": {
              "Success": {
                "value": {
                  "success": "true"
                }
              }
            }
          }
        }
      },
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      },
      "forbiddenError": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                },
                "error": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Permission Error": {
                "value": {
                  "success": "false",
                  "error": "User does not have the permissions required for this action [error-unauthorized]"
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "X-User-Id": {
        "name": "X-User-Id",
        "in": "header",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "CkCPNctrgCDfmWLqC",
        "description": "The user ID."
      },
      "X-Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "1Dd4iN_ClKn5jl-xPC36snQ4s9Zd5GZnXCQuCNSKcVE",
        "description": "The authentication token."
      }
    }
  }
}
````

