POST - Add User to Organization

Purpose

This API is used to add an user to the organization.  

OAuth Scope

Use the scope

ZohoMail.organization.accounts.ALL (or) ZohoMail.organization.accounts.CREATE 

to generate the Authtoken.

ALL - Grants full access to accounts.

CREATE - Grants create access to accounts.

Request URL 

Method: POST

https://mail.zoho.com/api/organization/{zoid}/accounts

Path Parameters

  • zoid* long
    • zoid denotes the unique Zoho Organization Identifier for the organization. 
    • The value can be retrieved using the GET Organization details API.

Request Body (JSON Object)

  • primaryEmailAddress* string
    • Specifies the domain-based primary email address for the user to be created. 
  • password* string
    • Specifies the password for the user to be created.
  • firstName string
    • Specifies the first name of the user.
  • lastName string
    • Specifies the last name of the user.
  • displayName string
    • Specifies the display name to be assigned to the user.
  • userExpiry int
    • Specifies the number of days after which the user account will expire.
    • Depending on the organisation's policy, any maximum value can be set, though 100 days is commonly used.
  • role string
    • Specifies the role to be assigned for the user to be created.
    • The value can be either
      •  member
      • admin
      • super_admin
  • country string
    • Specifies the country the user works from. Refer here for allowed values.
  • language string
    • Specifies the choice of language for the user. Refer here for allowed values.
  • timeZone string
    • Specifies the timezone the user works from. Refer here for allowed values.
  • oneTimePassword boolean
    • Specifies if the password is a one-time password.
    • Allowed values
      • true - The user will be asked to change the password on the first login.
      • false
  • groupMailList JSON Array
    • Specifies an array of the group's email addresses to which the user needs to be added.
    • The maximum number of group email addresses that can be added is 100.
    To Add to Zoho People

    If your organization uses Zoho People for HR management, you can add users to Zoho People using this API. Include fields such as employeeId, department, designation, mobileNumber, and extension in the request body. Note that employeeId and lastName are mandatory for adding data to Zoho People.

  • employeeId* string
    •  Provide the employee ID of the user.
  • lastName* string
    •  Provide the last name of the user.
  • department string
    •  Provide the department in which the user works.
  • designation string
    •  Provide the designation the user holds.
  • mobileNumber string
    •  Provide the mobile number of the user.
  • extension string
    •  Provide the extension number of the user.

 

* - Mandatory parameter

Response Codes

Refer here for the response codes and their meaning.

Sample Request

Copiedcurl "https://mail.zoho.com/api/organization/1234567890/accounts" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Zoho-oauthtoken 1********" \
-d '{
   "primaryEmailAddress": "rebecca@zylker.com",
   "password": "Abc@123",
   "firstName": "Rebecca",
   "lastName": "Anderson",
   "displayName": "Rebecca",
   "userExpiry": 100,
   "role": "member",
   "country": "in",
   "language": "En",
   "timeZone": "Asia/Kolkata",
   "oneTimePassword": false,
   "groupMailList": ["newgroupmail@zylker.com", "newgroup@zylker.com"],
   "employeeId": "E123",
   "lastName": "Anderson",
   "department": "Sales",
   "designation": "Manager",
   "mobileNumber": "+911234567890",
   "extension": "123"
}'

Sample Response

Copied{
 "status": {
 "code": 201,
 "description": "Created"
 },
 "data": {
 "country": "in",
 "lastLogin": -1,
 "mxStatus": true,
 "activeSyncEnabled": false,
 "mobileNumber": "",
 "isCustomAdmin": false,
 "incomingBlocked": false,
 "language": "en",
 "type": "ZOHO_ACCOUNT",
 "extraStorage": {},
 "incomingUserName": "rebecca@zylker.com",
 "emailAddress": [
 {
 "isAlias": false,
 "isPrimary": true,
 "mailId": "rebecca@zylker.com",
 "isConfirmed": true
 }
 ],
 "mailboxStatus": "enabled",
 "ediscoveryStorage": {
 "iseDiscoveryStorageEnabled": true,
 "ediscoveryUsedStorage": 0,
 "ediscoveryAllowedStorage": 0
 },
 "popBlocked": false,
 "usedStorage": 0,
 "spamcheckEnabled": true,
 "imapAccessEnabled": false,
 "timeZone": "Asia/Kolkata",
 "accountCreationTime": 1721137136405,
 "groupList": [
 {
 "zgid": 701628711,
 "role": "member",
 "name": "MailGroupForTesting",
 "emailId": "mailgroupfortesting@zylker.com",
 "isLogoExist": false
 }
 ],
 "zuid": 857813737,
 "webBlocked": false,
 "planStorage": 5,
 "firstName": "rebecca",
 "accountId": "8923900000000008002",
 "sequence": 1,
 "mailboxAddress": "rebecca@zylker.com",
 "lastPasswordReset": 1721137137968,
 "tfaEnabled": false,
 "iamStatus": 1,
 "iamGroupList": [],
 "phoneNumer": "",
 "status": true,
 "lastName": "",
 "accountDisplayName": "rebecca",
 "role": "member",
 "gender": "NOT_SPECIFIED",
 "accountName": "us-prof",
 "displayName": "rebecca",
 "customFields": [],
 "isLogoExist": false,
 "primaryEmailAddress": "rebecca@zylker.com",
 "enabled": true,
 "mailboxCreationTime": 1721137138724,
 "allowedStorage": 5242880,
 "sendMailDetails": [
 {
 "sendMailId": "8923900000000008004",
 "displayName": "rebecca",
 "serverName": "smtpout.mail.zoho.com",
 "signatureId": "null",
 "serverPort": 25,
 "userName": "rebecca@zylker.com",
 "connectionType": "plain",
 "mode": "mailbox",
 "validated": false,
 "fromAddress": "rebecca@zylker.com",
 "smtpConnection": 0,
 "validationRequired": true,
 "validationState": 0,
 "status": true
 }
 ],
 "popFetchTime": -1,
 "locationName": "",
 "address": {
 "country": "in",
 "streetAddr": "",
 "city": "",
 "postalCode": "",
 "state": ""
 },
 "planType": -1,
 "userExpiry": -1,
 "popAccessEnabled": true,
 "imapBlocked": false,
 "iamUserRole": "member",
 "outgoingBlocked": false,
 "policyId": {
 "1082700000192558003": "Business Policy",
 "zoid": 1234567890
 },
 "smtpStatus": true,
 "extraEDiscoveryStorage": {}
 }
}