> ## 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.

# 获取入群二维码链接

> 调用本接口可获取入群二维码邀请链接，适用于企业组织活动、项目协作等需快速邀请成员入群的场景。

调用本接口，获取群入群二维码邀请链接，适用于企业需要快速邀请成员加入群聊的场景，如组织活动、项目协作等。

## 请求

| **基本信息**    |                                                                                                  |
| ----------- | ------------------------------------------------------------------------------------------------ |
| HTTP URL    | [https://api.dingtalk.io/topapi/chat/qrcode/get](https://api.dingtalk.io/topapi/chat/qrcode/get) |
| HTTP Method | POST                                                                                             |
| 支持的应用类型     | appType-企业内部应用                                                                                   |
| 权限要求        | permission-qyapi\_chat\_base\_read-钉钉群管理基础信息读权限                                                  |

### 查询参数

| 名称            | 类型     | 是否必填 | 示例值            | 描述                                                                                   |
| ------------- | ------ | ---- | -------------- | ------------------------------------------------------------------------------------ |
| access\_token | String | 是    | 30c36943eaxxxx | 调用该接口的应用凭证，通过[获取企业内部应用的access\_token](/zh/open/development/obtain-orgapp-token)接口获取。 |

### 请求体

| 名称     | 类型     | 是否必填 | 示例值             | 描述                              |
| ------ | ------ | ---- | --------------- | ------------------------------- |
| chatid | String | 是    | chat3234dfs423a | 群会话的chatid，可调用创建群接口获取chatid参数值。 |
| userid | String | 是    | manager4220     | 分享二维码用户的userId。                 |

### 请求示例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/chat/qrcode/get" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=a1582fxxxx790254a' \
-d 'chatid=chat3234dfs423a' \
-d 'userid=314137418341347'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/qrcode/get");
OapiChatQrcodeGetRequest req = new OapiChatQrcodeGetRequest();
req.setChatid("chat3234dfs423a");
req.setUserid("manager4220");
OapiChatQrcodeGetResponse 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.OapiChatQrcodeGetRequest("https://api.dingtalk.io/topapi/chat/qrcode/get")

req.chatid="chat3234dfs423a"
req.userid="314137418341347"
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 OapiChatQrcodeGetRequest;
$req->setChatid("chat3234dfs423a");
$req->setUserid("314137418341347");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/chat/qrcode/get");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/chat/qrcode/get");
OapiChatQrcodeGetRequest req = new OapiChatQrcodeGetRequest();
req.Chatid = "chat3234dfs423a";
req.Userid = "314137418341347";
OapiChatQrcodeGetResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## 响应

### 响应体

| 名称          | 类型      | 示例值                                                            | 描述                                     |
| ----------- | ------- | -------------------------------------------------------------- | -------------------------------------- |
| result      | String  | [https://test/action/join?1233](https://test/action/join?1233) | 返回入群的链接。                               |
| success     | Boolean | true                                                           | 是否调用成功。   - **true**：成功 - **false**：失败 |
| errcode     | Number  | 0                                                              | 返回码。                                   |
| errmsg      | String  | ok                                                             | 返回码描述。                                 |
| request\_id | String  | 2tgtcjyjhptd                                                   | 请求ID。                                  |

### 响应体示例

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg": "ok",
  "result": "https://qr.dingtalk.io/action/joingroup?code=v1=&_dt_no_comment=1&origin=11",
  "success": true,
  "request_id": "4jzlii1im1ui"
}
```

### 错误码

若调用该接口报错，可根据错误信息在[全局错误码](/zh/open/development/server-api-error-codes-1)文档中查找解决方案。

| 错误码（errorcode） | 错误码描述（errmsg） | 解决方案          |
| -------------- | ------------- | ------------- |
| 34001          | 无效的会话id       | 请检查chatId是否正确 |
| 40003          | 不合法的userid    | 请确认userid是否正确 |
| 60124          | 用户不在此群中       | 请确认userid是否正确 |
| 400001         | 系统错误          | 请稍后再试         |
