Skip to main content
Call this API to query the list of admins.

API call description

This API is not restricted by the Contacts permission scope.

Request

Basic information
HTTP URLhttps://oapi.dingtalk.io/topapi/user/listadmin
HTTP MethodPOST
Supported app typesappType-Internal appappType-Third-party enterprise app
Required permissionspermission-qyapi_get_member-Read permission for user information

Query parameters

NameTypeRequiredExampleDescription
access_tokenStringYesbE74xxxxThe App credential used to call this API. - For an Internal app, obtain it through the API for getting the access_token of an Internal app. - For a Third-party enterprise app, obtain it through the API for getting the access_token of a third-party enterprise.

Request example

curl -X POST "https://oapi.dingtalk.io/topapi/user/listadmin" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=ba1dfdcc-8a86-4b95-bcb8-af2f9f91ae12'
Java
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/topapi/user/listadmin");
OapiUserListadminRequest req = new OapiUserListadminRequest();
OapiUserListadminResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
Python
import dingtalk.api

req=dingtalk.api.OapiUserListadminRequest("https://oapi.dingtalk.io/topapi/user/listadmin")
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 OapiUserListadminRequest;
$resp = $c->execute($req, $access_token, "https://oapi.dingtalk.io/topapi/user/listadmin");
C#
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.io/topapi/user/listadmin");
OapiUserListadminRequest req = new OapiUserListadminRequest();
OapiUserListadminResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);

Response

Response body

NameTypeExampleDescription
request_idString4f9md9obopn2The request ID.
errcodeNumber0The return code.
errmsgStringokThe description of the return code.
resultListAdminResponse[]The returned result.
useridString203xxxx1The userid of the admin.
sys_levelNumber1The admin role: - 1: Super Admin - 2: Sub Admin

Response body example

{
  "errcode": 0,
  "errmsg":"ok",
  "result": [
    {
      "sys_level": 2,
      "userid": "203xxxx1"
    },
    {
      "sys_level": 1,
      "userid": "mxxxxx0"
    }
  ],
  "request_id": "4f9md9obopn2"
}

Error codes

If an error occurs when you call this API, find the solution in the Global error codes document based on the error message.
Error code (errcode)Error message (errmsg)Solution
43007Authorization requiredCheck whether the access_token has permission to perform the action.
-1System busyTry again later.