Skip to main content
Call this API to get the details of a specified user.

API call description

This API lets you query the details of a regular account user or an Enterprise Account user. Because parameter usage differs significantly between the two scenarios, the documentation is split by account type for easier reference: If you need to obtain permissions for fields such as phone number and mail, the method varies by App type.
  • For an Internal app to obtain a user’s phone number and mail, add the permission to access phone numbers and mail in Contacts. To add the permission: Sign in to the DingTalk Developer Console > Internal Development > find the app to which you want to add the permission > Manage permissions > Contacts Management. Select Employee phone number and Mail and other Profile information, and click Request permission.
  • For a Third-party enterprise app to obtain a user’s phone number and mail, use the DingTalk unified authorization suite.

Request

Basic information
HTTP URLhttps://oapi.dingtalk.io/topapi/v2/user/get
HTTP MethodPOST
Supported app typesappType-Internal app, appType-Third-party enterprise app
Permission requirementspermission-qyapi_get_member-User information read permission

Query parameters

NameTypeRequiredExampleDescription
access_tokenStringYesbE74xxxxApp credential used to call this API. - For an Internal app, get it through the API for obtaining the access_token of an Internal app. - For a Third-party enterprise app, get it through the API for obtaining the access_token of a third-party enterprise.

Request body

NameTypeRequiredExampleDescription
useridStringYesmanager4220The userid of the user.
languageStringNozh_CNThe Contacts language. - zh_CN: Chinese (Default) - en_US: English

Request example

curl -X POST "https://oapi.dingtalk.io/topapi/v2/user/get" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=b97a231d-7dd8-4243-ac4e-6b75b2a1e28a' \
-d 'language=zh_CN' \
-d 'userid=zhangsan'
Java
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/topapi/v2/user/get");
OapiV2UserGetRequest req = new OapiV2UserGetRequest();
req.setUserid("001");
req.setLanguage("zh_CN");
OapiV2UserGetResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
Python
import dingtalk.api

req=dingtalk.api.OapiV2UserGetRequest("https://oapi.dingtalk.io/topapi/v2/user/get")

req.userid="zhangsan"
req.language="zh_CN"
try:
	resp= req.getResponse(access_token)
	print(resp)
except Exception,e:
	print(e)
PHP
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiV2UserGetRequest;
$req->setUserid("zhangsan");
$req->setLanguage("zh_CN");
$resp = $c->execute($req, $access_token, "https://oapi.dingtalk.io/topapi/v2/user/get");
C#
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/topapi/v2/user/get");
OapiV2UserGetRequest req = new OapiV2UserGetRequest();
req.Userid = "zhangsan";
req.Language = "zh_CN";
OapiV2UserGetResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);

Response

Response body

NameTypeExampleDescription
request_idString4e7exhl6pm0tThe request ID.
errcodeNumber0The return code.
errmsgStringokThe description of the return code.
resultObjectThe returned result.
useridStringzhangsanThe userid of the Employee.
unionidStringz21HjQliSzpw0YWCNxmii6u2Os62cZ62iSZThe unique identifier of the Employee within the current developer enterprise account scope.
nameStringJohnThe Employee’s Name.
avatarStringxxxProfile Photo. Note If the Employee uses the default Profile Photo, this field is not returned. It is returned only when the Profile Photo is set manually.
state_codeString86The international country calling code. Note This field is not returned for a Third-party enterprise app. To obtain state_code, use the DingTalk unified authorization suite.
manager_useridStringuser01The Employee’s direct manager. Note This field is returned only when the Direct Manager field on the Employee’s Profile panel in the enterprise admin console has a value.
mobileString13800138000The phone number. Note - For an Internal app, this field is returned only when the App has been granted the Employee phone number permission in Contacts. - This field is not returned for a Third-party enterprise app. To obtain mobile, use the DingTalk unified authorization suite.
hide_mobileBooleanfalseWhether the phone number is hidden: - true: hidden - false: not hidden Note When the phone number is hidden, it is hidden on the Profile page, but you can still send DING messages and initiate Free DingTalk business calls to it.
telephoneString010-86123456-2345The extension number. Note This parameter is not returned for a Third-party enterprise app.
job_numberString4The Employee ID.
titleStringTechnical DirectorThe Job Title.
emailStringtest@xxx.comThe Employee’s Mail. Note - For an Internal app, this field is returned only when the App has been granted the Mail and other Profile information permission in Contacts. - This parameter is not returned for a Third-party enterprise app. To obtain email, use the DingTalk unified authorization suite.
work_placeStringFuture ParkThe Work Location. Note - This field is returned only when it has a value on the Employee Profile panel. If empty, the field is not returned. - For an Internal app, this field is returned only when the App has been granted the Mail and other Profile information permission in Contacts. - This parameter is not returned for a Third-party enterprise app.
remarkStringRemarkThe Alias. Note - This field is returned only when it has a value on the Employee Profile panel. If empty, the field is not returned. - For an Internal app, this field is returned only when the App has been granted the Mail and other Profile information permission in Contacts. - This parameter is not returned for a Third-party enterprise app.
exclusive_accountBooleanfalseWhether the user is an Enterprise Account: - true: yes - false: no
org_emailStringtest@xxx.comThe Employee’s Enterprise Mail. If the Employee’s Enterprise Mail is not enabled, this data is not included in the response. Note This parameter is not returned for a Third-party enterprise app.
dept_id_listNumber[][2,3,4]The list of department IDs the Employee belongs to.
dept_order_listObject[]The Employee’s Sort order within each Department.
dept_idNumber2The department ID.
orderNumber1The Employee’s Sort order within the Department.
extensionString{"Hobby":"Travel","Age":"24"}Extended Attributes, up to 2000 characters in length. Note - Returned only when an extended Field added on the Employee Profile panel has a value. - For an Internal app, this field is returned only when the App has been granted the Mail and other Profile information permission in Contacts. - This field is not returned for a Third-party enterprise app. - Important: Adding a new Attribute directly overwrites existing Attribute values. First fetch the existing Attributes, append the new Attribute, and then perform a full Update.
hired_dateNumber1597573616828The hire date. A Unix timestamp in milliseconds. Note - Returned only when the Hire Date field on the Profile panel has a value. - This parameter is not returned for a Third-party enterprise app.
activeBooleantrueWhether DingTalk has been activated: - true: activated - false: not activated
real_authedBooleantrueWhether real-name Authentication is completed: - true: verified - false: not verified
seniorBooleantrueWhether the Employee is an Organization executive: - true: yes - false: no
adminBooleantrueWhether the Employee is an Organization Admin: - true: yes - false: no
bossBooleantrueWhether the Employee is the Organization boss: - true: yes - false: no
leader_in_deptObject[]The Employee’s Department information and whether the Employee is a leader: - The Department ID of the Department the Employee belongs to. - Whether the Employee is a leader in the corresponding Department: - true: yes - false: no
dept_idNumber2The Department ID.
leaderBooleantrueWhether the Employee is a leader: - true: yes - false: no
role_listObject[]The Role List.
idNumber100The Role ID.
nameStringDirectorThe Role Name.
group_nameStringPositionThe role group Name.
union_emp_extObjectAssociation information when the user comes from an associated Organization. Note This field is returned when the Organization the user belongs to has an Association relationship with another Organization.
useridString500The Employee’s userid.
union_emp_map_listObject[]The Association mapping.
useridString5000The userid of the Employee in the associated branch Organization.
corp_idStringdingxxxThe corpId of the associated branch Organization.
corp_idStringdingxxxThe corpId of the Organization the current user belongs to.
dept_position_listDeptPosition[]Position information within the Department.
extension_i18nJson{"Hobby": {"zh_CN": "旅游", "en_US": "travel", "aJP": "旅行"}}Internationalized values of the extended Attributes.

Response body example

{
  "errcode":"0",
  "result":{
    "extension":"{\"Hobby\":\"Travel\",\"Age\":\"24\"}",
    "unionid":"z21HjQliSzpw0YWxxxxx",
    "boss":"true",
    "role_list":{
      "group_name":"Position",
      "name":"Director",
      "id":"100"
    },
    "exclusive_account":false,
    "manager_userid":"manager240",
    "admin":"true",
    "remark":"Remark",
    "title":"Technical Director",
    "hired_date":"1597573616828",
    "userid":"zhangsan",
    "work_place":"Future Park",
    "dept_order_list":{
      "dept_id":"2",
      "order":"1"
    },
    "real_authed":"true",
    "dept_id_list":"[2,3,4]",
    "job_number":"4",
    "email":"test@xxx.com",
    "leader_in_dept":{
      "leader":"true",
      "dept_id":"2"
    },
    "mobile":"13800138000",
    "active":"true",
    "org_email":"test@xxx.com",
    "telephone":"010-86123456-2345",
    "avatar":"xxx",
    "hide_mobile":"false",
    "senior":"true",
    "name":"John",
    "union_emp_ext":{
      "union_emp_map_list":{
        "userid":"5000",
        "corp_id":"dingxxx"
      },
      "userid":"500",
      "corp_id":"dingxxx"
    },
    "state_code":"86"
  },
  "errmsg":"ok"
}

Error codes

If the API call returns an Error, look up the solution by error message in the Global error codes documentation.
Error code (errcode)Error code description (errmsg)Solution
33012Invalid useridCheck whether the userid is correct.
400002Invalid parameterCheck whether the parameter is entered as required.
-1System busyTry again Later.