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

# Recall a Work Notification

> Call this API to recall a Work Notification, suitable for internal apps recalling mistakenly sent messages, with permission and request/response details.

Call this API to recall a Work Notifications message. This applies to scenarios where an internal app needs to recall a Work Notifications message that was sent by mistake.

## API call description

You can only recall Work Notifications messages sent within the last 24 hours.

## Permissions

Server API authorization is granted at the app level. When you create an app, the Message notifications permission is added by default.

| App type                   | Supported     | How to apply                                 | API Explorer Debug                                                                                                 |
| -------------------------- | ------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Internal app               | Supported     | Enabled by default. No application required. | [Debug](https://open-dev.dingtalk.io/apiExplorer#/?devType=org\&api=dingtalk.oapi.message.corpconversation.recall) |
| Third-party enterprise app | Supported     | Enabled by default. No application required. | [Debug](https://open-dev.dingtalk.io/apiExplorer#/?devType=isv\&api=dingtalk.oapi.message.corpconversation.recall) |
| Third-party personal app   | Not supported | —                                            | —                                                                                                                  |

## Basic information

**HTTP method**: POST

**Request URL**:

## Request

| **Basic information** |                                                                                                                                  |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| HTTP URL              | [https://api.dingtalk.io/topapi/message/corpconversation/recall](https://api.dingtalk.io/topapi/message/corpconversation/recall) |
| HTTP Method           | POST                                                                                                                             |
| Supported app types   | appType-Internal app, appType-Third-party enterprise app                                                                         |
| Permissions required  | permission-qyapi\_base-Basic permissions required to call enterprise APIs                                                        |

### 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 to get the [access\_token of an internal app](/open/development/obtain-orgapp-token). - For a third-party enterprise app, obtain it by calling the API to get the access\_token of a third-party enterprise. |

### Request body

| Name          | Type   | Required | Example      | Description                                                                                                                                                                                                                                                                                                                      |
| ------------- | ------ | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| agent\_id     | Number | Yes      | 836390886    | The Agent ID of the Micro app used to send the message.   - For an internal app, you can find this on the app details page in the [Developer Backend](https://open-dev.dingtalk.io/#/appMgr/inner/h5/836390886/1). - For a third-party enterprise app, obtain it by calling the API to get enterprise authorization information. |
| msg\_task\_id | Number | Yes      | 256271667526 | The task ID returned by DingTalk when the message was sent. Call the [Send a Work Notification](/open/development/asynchronous-sending-of-enterprise-session-messages) API to obtain the value of the task\_id parameter.  **Note**  Only Work Notifications messages sent within the last 24 hours can be recalled.             |

### Request example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/message/corpconversation/recall" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=404080xxxx4ab30' \
-d 'agent_id=1000' \
-d 'msg_task_id=2000'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/message/corpconversation/recall");
OapiMessageCorpconversationRecallRequest req = new OapiMessageCorpconversationRecallRequest();
req.setAgentId(1000L);
req.setMsgTaskId(2000L);
OapiMessageCorpconversationRecallResponse rsp = client.execute(req, accessToken);
System.out.println(rsp.getBody());
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiMessageCorpconversationRecallRequest("https://api.dingtalk.io/topapi/message/corpconversation/recall")

req.agent_id=1000
req.msg_task_id=2000
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 OapiMessageCorpconversationRecallRequest;
$req->setAgentId("1000");
$req->setMsgTaskId("2000");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/message/corpconversation/recall");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/message/corpconversation/recall");
OapiMessageCorpconversationRecallRequest req = new OapiMessageCorpconversationRecallRequest();
req.AgentId = 1000L;
req.MsgTaskId = 2000L;
OapiMessageCorpconversationRecallResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response body

| Name    | Type   | Example | Description                  |
| ------- | ------ | ------- | ---------------------------- |
| errmsg  | String | ok      | The return code description. |
| errcode | Number | 0       | The return code.             |

### Response body example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode":0,
  "errmsg":"ok"
}
```

### Error codes

If an error occurs when calling this API, look up the solution in the [global error codes](/open/development/server-api-error-codes-1) document using the error message.

| Error code (errorcode) | Error message description (errmsg) | Solution                                    |
| ---------------------- | ---------------------------------- | ------------------------------------------- |
| 400002                 | Invalid agentId or taskId          | Verify that agentId and taskId are correct. |
| 500                    | System error                       | An unknown system error occurred.           |
