> ## 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 external contact details

> Call this API to get the details of an external contact of an organization, including basic profile and tag information.

Call this API to get the detailed information of an external contact in your organization.

## Request

| **Basic information** |                                                                                                |
| --------------------- | ---------------------------------------------------------------------------------------------- |
| HTTP URL              | [https://api.dingtalk.io/topapi/extcontact/get](https://api.dingtalk.io/topapi/extcontact/get) |
| HTTP Method           | POST                                                                                           |
| Supported app types   | appType-Internal app, appType-Third-party enterprise app                                       |
| Permissions           | permission-qyapi\_ext\_read-Read permission for external contacts                              |

### Query parameters

| Name          | Type   | Required | Example  | Description                                                                                                                                                                                                                                                                                                            |
| ------------- | ------ | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | Yes      | bE74xxxx | The app credential used to call this API.   - For an internal app, obtain it by calling the API for getting the [access\_token of an internal app](/open/development/obtain-orgapp-token). - For a third-party enterprise app, obtain it by calling the API for getting the access\_token of a third-party enterprise. |

### Request body

| Name     | Type   | Required | Example        | Description                                                                                                                                                                     |
| -------- | ------ | -------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| user\_id | String | Yes      | 112500xxxx4889 | The user ID of the external contact. Call the [Get the external contact list](/open/development/obtain-the-external-contact-list) API to get the value of the userid parameter. |

### Request example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/extcontact/get" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=53584xxxx2c50b' \
-d 'user_id=112500xxxx4889'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/extcontact/get");
OapiExtcontactGetRequest req = new OapiExtcontactGetRequest();
req.setUserId("112500xxxx4889");
OapiExtcontactGetResponse 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.OapiExtcontactGetRequest("https://api.dingtalk.io/topapi/extcontact/get")

req.user_id="112500xxxx4889"
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 OapiExtcontactGetRequest;
$req->setUserId("112500xxxx4889");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/extcontact/get");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/extcontact/get");
OapiExtcontactGetRequest req = new OapiExtcontactGetRequest();
req.UserId = "112500xxxx4889";
OapiExtcontactGetResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response body

| Name               | Type           | Example                       | Description                                                                                   |
| ------------------ | -------------- | ----------------------------- | --------------------------------------------------------------------------------------------- |
| result             | OpenExtContact |                               | The query result.                                                                             |
| title              | String         | Development Engineer          | The job title.                                                                                |
| share\_dept\_ids   | Number\[]      | \[1,2,3]                      | The list of shared department IDs.                                                            |
| label\_ids         | Number\[]      | \[1,2,3]                      | The tags.                                                                                     |
| remark             | String         | Alias content                 | The alias.                                                                                    |
| address            | String         | Address content               | The address.                                                                                  |
| name               | String         | Zhang San                     | The name.                                                                                     |
| follower\_user\_id | String         | 6767531692                    | The user ID of the owner.                                                                     |
| state\_code        | String         | 86                            | The country code.                                                                             |
| company\_name      | String         | DingTalk                      | The company name.                                                                             |
| share\_user\_ids   | String\[]      | \["042059613752"]             | The list of user IDs of shared employees.                                                     |
| mobile             | String         | 13088888888                   | The mobile number.  **Note**: This parameter is not returned for third-party enterprise apps. |
| userid             | String         | 0123456789                    | The user ID of the external contact.                                                          |
| email              | String         | [xxx@1.com](mailto:xxx@1.com) | The email address.                                                                            |
| errcode            | Number         | 0                             | The return code.                                                                              |
| errmsg             | String         | ok                            | The description of the return code.                                                           |
| request\_id        | String         | xrudojam4g8f                  | The request ID.                                                                               |

### Response example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode":0,
  "result":{
    "share_user_ids":[
      "66220007745510"
    ],
    "follower_user_id":"manager4220",
    "address":"Beijing",
    "share_dept_ids":[],
    "label_ids":[
      1561077317
    ],
    "share_dept_ids": [
      42xxxx36
    ],
    "mobile":"136***47616",
    "remark":"Technical Lead",
    "title":"CFO",
    "userid":"011250026469774889",
    "company_name":"DingTalk",
    "name":"Manager Wang",
    "state_code":"86",
    "email":"zhang@example.com"
  },
  "request_id":"xrudojam4g8f"
}
```

### 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                                                                |
| -------------------- | ----------------------------- | ----------------------------------------------------------------------- |
| 33009                | Invalid tokenGrantType        | Check whether the access\_token is correct.                             |
| 33012                | Invalid userId                | Check whether the userId is correct.                                    |
| 43007                | Operation permission required | Check whether the access\_token has the required operation permissions. |
| 400001               | System error                  | Try again later.                                                        |
