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

# グループ参加用 QR コードリンクを取得

> グループ参加用 QR コードの招待リンクでメンバーを迅速にグループチャットへ招待できます

本 API を呼び出すことで、グループ参加用 QR コードの招待リンクを取得できます。組織イベントやプロジェクトコラボレーションなど、企業がメンバーを迅速にグループチャットへ招待する必要があるシーンに適しています。

## リクエスト

| **基本情報**     |                                                                                                  |
| ------------ | ------------------------------------------------------------------------------------------------ |
| 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-DingTalk グループ管理のベーシック情報読み取り権限                                 |

### クエリパラメータ

| 名前            | タイプ    | 必須 | 例              | 説明                                                                                                         |
| ------------- | ------ | -- | -------------- | ---------------------------------------------------------------------------------------------------------- |
| access\_token | String | はい | 30c36943eaxxxx | 当該 API を呼び出すためのアプリ認証情報。[社内アプリの access\_token を取得する](/ja/open/development/obtain-orgapp-token) API から取得します。 |

### リクエストボディ

| 名前     | タイプ    | 必須 | 例               | 説明                                                        |
| ------ | ------ | -- | --------------- | --------------------------------------------------------- |
| chatid | String | はい | chat3234dfs423a | グループチャットの chatid。グループ作成 API を呼び出して chatid パラメータの値を取得できます。 |
| userid | String | はい | manager4220     | QR コードを共有するユーザーの 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"
}
```

### エラーコード

当該 API の呼び出しでエラーが発生した場合、エラーメッセージをもとに[グローバルエラーコード](/ja/open/development/server-api-error-codes-1)ドキュメントから解決方法を検索できます。

| エラーコード（errorcode） | エラーコードの説明（errmsg）  | 解決方法                |
| ----------------- | ------------------ | ------------------- |
| 34001             | 無効なチャット ID です      | chatId が正しいかご確認ください |
| 40003             | 不正な userid です      | userid が正しいかご確認ください |
| 60124             | ユーザーがこのグループに存在しません | userid が正しいかご確認ください |
| 400001            | システムエラー            | 後で再度お試しください         |
