Add User
Purpose
To add a user to your organization.
Endpoints
- POST /users
Request Details
Request URL
{api-domain}/crm/{version}/users
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.users.{operation_type}
Possible operation types
ALL - Full access to users
CREATE - To create users
Note
- You can add only one user per POST request.
- Adding a CRM Plus user through API is not supported. You can only add a CRM Plus user through the UI.
- You must use only Field API names in the input. You can obtain the field API names from Fields metadata API (the value for the key “api_name” for every field).
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/users"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@newuser.json"
-X POST
Copieduser1 = Map();
user1.put("last_name", "Shawn");
user1.put("email", "shawn@zylker.com");
user1.put("role", "692969000000015969");
user1.put("profile", "692969000000015972");
users = List();
users.add(user1);
params = Map();
params.put("users", users);
response = invokeurl
[
	url: "https://www.zohoapis.com/crm/v8/users"
	type: POST
	parameters: params.toString()
	connection:"crm_connection"
];
info response ;In the request, "@newuser.json" contains the sample input data.
Request JSON
- first_namestring, mandatorySpecify the first name of the user. 
- emailstring, mandatorySpecify the email ID of the user. 
- rolestring, mandatorySpecify the unique ID of the role you want to assign the user with. You can obtain the role ID from the Roles API. 
- profilestring, mandatorySpecify the unique ID of the profile you want to assign the user with, to decide the user's level of access to CRM data. You can obtain the profile ID from the Profiles API. 
Refer to Add Records API to know about the field types and limitations.
Sample Input
Copied{
  "users": [
    {
      "role": "554023000000015969",
      "first_name": "Patricia",
      "email": "Patricia@abcl.com",
      "profile": "554023000000015975",
      "last_name": "Boyle",
      "name_format__s":"Salutation,First Name,Last Name",
      "sort_order_preference__s": "First Name,Last Name"
    }
  ]
}Possible Errors
- INVALID_REQUESTHTTP 400Cannot add user under CRM Plus account. Kindly use CRMPlus URL to add user. 
 Resolution: Adding a CRM Plus user through API is not supported. You can only add a CRM Plus user through the UI. Refer to the note section above.
- LICENSE_LIMIT_EXCEEDEDHTTP 400Request exceeds your license limit. Need to upgrade in order to add. 
 Resolution: The maximum number of users you can add per your CRM plan has exceeded. Please buy additional user licenses to add more users.
- DUPLICATE_DATAHTTP 400Failed to add user since same email id is already present 
 Resolution: You have entered a duplicate value for the email_id. Make sure you give unique values for the email_id and last_name fields.
- MANDATORY_NOT_FOUNDHTTP 400Last Name is required 
 Resolution: You have not specified one of the mandatory keys. Refer to request JSON section above.
- INVALID_DATAHTTP 400Invalid data. Valid values are comma/space/period/none. 
 Resolution: The key value specified is invalid. It can contain only the above mentioned special characters.
- INVALID_DATAHTTP 400This user cannot be added as they have rejected invitation sent 
 Resolution: You cannot add a user that has rejected the invitation to be added to your org.
- FORBIDDENHTTP 403Permission denied 
 Resolution: Only the users with user profile is "administrator" can add new users. Contact your system administrator.
- INVALID_URL_PATTERNHTTP 404Please check if the URL trying to access is a correct one 
 Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above.
- OAUTH_SCOPE_MISMATCHHTTP 401Unauthorized 
 Resolution: Client does not have ZohoCRM.users.CREATE scope. Create a new client with valid scope. Refer to scope section above.
- NO_PERMISSIONHTTP 403Permission denied to create 
 Resolution: The user does not have permission to create user records. Contact your system administrator.
- INTERNAL_ERRORHTTP 500Internal Server Error 
 Resolution: Unexpected and unhandled exception in the server. Contact support team.
- INVALID_REQUEST_METHODHTTP 400The http request method type is not a valid one 
 Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above.
- AUTHORIZATION_FAILEDHTTP 400User does not have sufficient privilege to add new users 
 Resolution: The user does not have the permission to add users. Contact your system administrator.
Sample Response
Copied{
  "users": [
    {
      "code": "SUCCESS",
      "details": {
        "id": "554023000000691003"
      },
      "message": "User added",
      "status": "success"
    }
  ]
}