> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the Contacts permission scope of an admin

> Call this API to get the Contacts permission scope of an administrator.

Call this API to get the Contacts permission scope of an admin.

## Request

| **Basic information** |                                                                                                              |
| --------------------- | ------------------------------------------------------------------------------------------------------------ |
| HTTP URL              | [https://api.dingtalk.io/topapi/user/get\_admin\_scope](https://api.dingtalk.io/topapi/user/get_admin_scope) |
| HTTP Method           | POST                                                                                                         |
| Supported app types   | appType-Internal app, appType-Third-party enterprise app                                                     |
| Required permissions  | permission-qyapi\_get\_member-Read permission for user information                                           |

### Query parameter

| Name          | Type   | Required | Example  | Description                                                                                                                                                                                                                                                                                                      |
| ------------- | ------ | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | Yes      | bE74xxxx | The 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](/open/development/obtain-orgapp-token). - For a Third-party enterprise app, obtain it through the API for getting the access\_token of a third-party enterprise. |

### Request body

| Name   | Type   | Required | Example   | Description                                                                                                                                                    |
| ------ | ------ | -------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userid | String | Yes      | manger123 | The user ID of the Admin. Call the [Get the admin list](/open/development/query-the-administrator-list) API to get the admin IDs in your current Organization. |

### Request example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/user/get_admin_scope" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=f928c8b2-5f41-4c92-908a-01fee1f20450' \
-d 'userid=manager7078'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/user/get_admin_scope");
OapiUserGetAdminScopeRequest req = new OapiUserGetAdminScopeRequest();
req.setUserid("manger123");
OapiUserGetAdminScopeResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiUserGetAdminScopeRequest("https://api.dingtalk.io/topapi/user/get_admin_scope")

req.userid="manager7078"
try:
  resp= req.getResponse(access_token)
  print(resp)
except Exception,e:
  print(e)
```

PHP

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiUserGetAdminScopeRequest;
$req->setUserid("manager7078");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/user/get_admin_scope");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/user/get_admin_scope");
OapiUserGetAdminScopeRequest req = new OapiUserGetAdminScopeRequest();
req.Userid = "manager7078";
OapiUserGetAdminScopeResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response body

| Name        | Type      | Example      | Description                                           |
| ----------- | --------- | ------------ | ----------------------------------------------------- |
| request\_id | String    | zpucraudovy0 | The request ID.                                       |
| errcode     | Number    | 0            | The return code.                                      |
| errmsg      | String    | ok           | The description of the return code.                   |
| dept\_ids   | Number\[] | \[1]         | The List of Department IDs that the admin can manage. |

### Response body example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "dept_ids": [
    1
  ],
  "errcode": 0,
  "errmsg": "ok",
  "request_id": "zpucraudovy0"
}
```

### Error codes

If an error is returned when you call this API, find the solution in the [Global error codes](/open/development/server-api-error-codes-1) document based on the error message.

| Error code (errcode) | Error message (errmsg) | Solution                                           |
| -------------------- | ---------------------- | -------------------------------------------------- |
| 60121                | Employee not found     | Confirm whether the userId is correct.             |
| 40036                | Parameter is empty     | Confirm that all required parameters are provided. |
| 400001               | System error           | Try again later.                                   |
