Import Users

Description

The import users endpoint can be used to import users to an Internal Directory or a Profile Group.

Users are imported via file upload, using an XSLX, XLS or CSV file (a CSV-structured request body can also be used to perform a 'fileless' user import).

A list of available fields can be found in our Community KB. The import users endpoint also supports AAA accounts, to import users to specific mail-processing child accounts.

Note: If using the CSV file format, ensure your body ends with a new line character, to indicate the end of the file.

Pre-requisites

  • In order to successfully use this endpoint the logged in user must be a Mimecast administrator with at least the Directories | Import | Edit permission.

URI

To use this endpoint you send a POST request to:

  • /api/user/import-users

Request Headers

The following request headers must be included in your request:

Field Description
Authorization Please see the Authorization guide for more information on building the Authorization header.
x-mc-req-id

A randomly generated GUID, for example,

8578FCFC-A305-4D9A-99CB-F4D5ECEFE297
x-mc-app-id The Application ID provided with your Registered API Application.
x-mc-date

The current date and time in the following format, for example,

Tue, 24 Nov 2015 12:50:11 UTC
x-mc-arg

A JSON object containing an x-mc-arg Header Object

{"data":[{"notifyEmailAddress":"String","allowAddressMigration":true,
"groupId":"String","clearGroup":false,"fileType":"csv"}]}
x-mc-arg Header Object
Field Type Required Description
data Array of one x-mc-arg Object Required Structured similar to other API call request bodies, this endpoint should have a single data object within an array.
x-mc-arg Header data Object
Field Type Required Description
notifyEmailAddress String Optional Email address of a recpient to be notified when the user import has completed.
allowAddressMigration Boolean Optional If using a AAA account structure, this option will allow the import to migrate the address from one account to another. If set to true, the user's accountCode value will be used as the target account. The default value is false.
groupId String Optional The Mimecast secure ID of a Profile Group, to which the users should be added.
clearGroup Boolean Optional If being used to add users to a group with a groupId, this option can be used to determine if the group should be cleared prior to making additions. The default value is false.
fileType String Optional Specifies the file format of the data submitted in the request body. Must be one of CSV, XLS or XLSX. The default value is XLS.

Response

{
 "fail": [], 
 "meta": {
  "status": 200
 }, 
 "data": [
  {
   "id": "String", 
   "success": true
  }
 ]
}
meta object
Field Type Description
status Number The function level status of the request.
meta
Field Type Description
status Number The function level status of the request.
data
Field Type Description
success Boolean Returns true if the import job has been successfully submitted.
id String The Mimecast secure ID of the import job.

Sample Code

Sample code is provided to demonstrate how to use the API and is not representative of a production application. To use the sample code; complete the required variables as described, populate the desired values in the request body, and execute in your favorite IDE.  Please see the Global Base URL's page to find the correct base URL to use for your account.

POST {base_url}/api/user/import-users
Authorization: MC {accesskKey}:{Base64 encoded signed Data To Sign}
x-mc-date: {dateTime}
x-mc-req-id: {unique id}
x-mc-app-id: {applicationId}
Content-Type: application/json
Accept: application/json


*** user import file ***
Back to Top