Skip to main content
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 URLhttps://oapi.dingtalk.io/topapi/chat/qrcode/get
HTTP MethodPOST
Supported app typesappType-Internal app
Required permissionspermission-qyapi_chat_base_read-Read permission for basic information of DingTalk Group Management

Query parameters

NameTypeRequiredExampleDescription
access_tokenStringYes30c36943eaxxxxThe app credential used to call this API. Obtain it through the API for getting the access_token of an internal app.

Request body

NameTypeRequiredExampleDescription
chatidStringYeschat3234dfs423aThe chatid of the group chat. Call the API for creating a group chat to obtain the value of the chatid parameter.
useridStringYesmanager4220The userId of the user who shares the QR code.

Request example

curl -X POST "https://oapi.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
DingTalkClient client = new DefaultDingTalkClient("https://oapi.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
import dingtalk.api

req=dingtalk.api.OapiChatQrcodeGetRequest("https://oapi.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
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://oapi.dingtalk.io/topapi/chat/qrcode/get");
C#
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.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

NameTypeExampleDescription
resultStringhttps://test/action/join?1233The link to join the group chat.
successBooleantrueWhether the call succeeded. - true: Success - false: Failed
errcodeNumber0The return code.
errmsgStringokThe description of the return code.
request_idString2tgtcjyjhptdThe request ID.

Response example

{
  "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 document to find a solution based on the error message.
Error code (errorcode)Error message (errmsg)Solution
34001Invalid chat IDCheck whether the chatId is correct.
40003Invalid useridCheck whether the userid is correct.
60124The user is not in this group chatCheck whether the userid is correct.
400001System errorTry again later.