> ## 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 QR code link to join a group

> Call this API to get the QR code invitation link for joining a group, suitable for quickly inviting members in scenarios like events and project collaboration.

Call this API to get the QR code invitation link for joining a group chat. This applies to scenarios where your organization needs to quickly invite users to join a group chat, such as team activities or project collaboration.

## Request

| **Basic information** |                                                                                                       |
| --------------------- | ----------------------------------------------------------------------------------------------------- |
| HTTP URL              | [https://api.dingtalk.io/topapi/chat/qrcode/get](https://api.dingtalk.io/topapi/chat/qrcode/get)      |
| HTTP Method           | POST                                                                                                  |
| Supported app types   | appType-Internal app                                                                                  |
| Required permissions  | permission-qyapi\_chat\_base\_read-Read permission for basic information of DingTalk Group Management |

### Query parameters

| Name          | Type   | Required | Example        | Description                                                                                                                                                    |
| ------------- | ------ | -------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | Yes      | 30c36943eaxxxx | The app credential used to call this API. Obtain it through the API for getting the [access\_token of an internal app](/open/development/obtain-orgapp-token). |

### Request body

| Name   | Type   | Required | Example         | Description                                                                                                       |
| ------ | ------ | -------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
| chatid | String | Yes      | chat3234dfs423a | The chatid of the group chat. Call the API for creating a group chat to obtain the value of the chatid parameter. |
| userid | String | Yes      | manager4220     | The userId of the user who shares the QR code.                                                                    |

### Request example

```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);
```

## Response

### Response body

| Name        | Type    | Example                                                        | Description                                                           |
| ----------- | ------- | -------------------------------------------------------------- | --------------------------------------------------------------------- |
| result      | String  | [https://test/action/join?1233](https://test/action/join?1233) | The link to join the group chat.                                      |
| success     | Boolean | true                                                           | Whether the call succeeded.   - **true**: Success - **false**: Failed |
| errcode     | Number  | 0                                                              | The return code.                                                      |
| errmsg      | String  | ok                                                             | The description of the return code.                                   |
| request\_id | String  | 2tgtcjyjhptd                                                   | The request ID.                                                       |

### Response example

```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"
}
```

### Error codes

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

| Error code (errorcode) | Error message (errmsg)             | Solution                             |
| ---------------------- | ---------------------------------- | ------------------------------------ |
| 34001                  | Invalid chat ID                    | Check whether the chatId is correct. |
| 40003                  | Invalid userid                     | Check whether the userid is correct. |
| 60124                  | The user is not in this group chat | Check whether the userid is correct. |
| 400001                 | System error                       | Try again later.                     |
