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

# Update the status bar of a work notification

> Call this API to update the status of an OA work notification message. Documents the API call method, request parameters, and response structure.

Call this API to update the status of an OA work notification message.

## API call description

* This API is designed for OA work notifications and updates approval statuses in real time.
* This API can only update the status bar of work notifications sent within the past 7 days.

## Request

| **Basic information** |                                                                                                                                                         |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HTTP URL              | [https://api.dingtalk.io/topapi/message/corpconversation/status\_bar/update](https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update) |
| HTTP Method           | POST                                                                                                                                                    |
| Supported app types   | appType-Internal appappType-Third-party enterprise app                                                                                                  |
| Required permissions  | 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 for getting the [access\_token of an internal app](/open/development/obtain-orgapp-token). - For a third-party enterprise app, obtain it by calling the API for getting the access\_token of a third-party enterprise. |

### Request body

| Name          | Type   | Required | Example    | Description                                                                                                                                                                                                                                                                                                                |
| ------------- | ------ | -------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| agent\_id     | Number | Yes      | 123        | The AgentId of the micro app used to send the message.   - For an internal app, view it 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 for getting enterprise authorization information. |
| task\_id      | Number | Yes      | 11         | The ID of the work notification task. Obtain the task\_id value by calling the [Send work notifications](/open/development/asynchronous-sending-of-enterprise-session-messages) API.                                                                                                                                       |
| status\_value | String | Yes      | Accepted   | The status bar value.                                                                                                                                                                                                                                                                                                      |
| status\_bg    | String | No       | 0xFF78C06E | The background color of the status bar. We recommend the format 0xFF followed by a six-digit color value.                                                                                                                                                                                                                  |

### Request example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e4bbxxxxe7683' \
-d 'agent_id=123' \
-d 'status_bg=0xFFF65E5E' \
-d 'status_value=Completed' \
-d 'task_id=1111'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update");
OapiMessageCorpconversationStatusBarUpdateRequest req = new OapiMessageCorpconversationStatusBarUpdateRequest();
req.setAgentId(123L);
req.setTaskId(1111L);
req.setStatusValue("Completed");
req.setStatusBg("0xFFF65E5E");
OapiMessageCorpconversationStatusBarUpdateResponse 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.OapiMessageCorpconversationStatusBarUpdateRequest("https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update")

req.agent_id=123
req.task_id=1111
req.status_value="Completed"
req.status_bg="0xFFF65E5E"
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 OapiMessageCorpconversationStatusBarUpdateRequest;
$req->setAgentId("123");
$req->setTaskId("1111");
$req->setStatusValue("Completed");
$req->setStatusBg("0xFFF65E5E");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update");
OapiMessageCorpconversationStatusBarUpdateRequest req = new OapiMessageCorpconversationStatusBarUpdateRequest();
req.AgentId = 123L;
req.TaskId = 1111L;
req.StatusValue = "Completed";
req.StatusBg = "0xFFF65E5E";
OapiMessageCorpconversationStatusBarUpdateResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response body

| Name        | Type   | Example      | Description                         |
| ----------- | ------ | ------------ | ----------------------------------- |
| request\_id | String | 4jzllmte0wau | The request ID.                     |
| errmsg      | String | ok           | The description of the return code. |
| errcode     | Number | 0            | The return code.                    |

### Response body example

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

### Error codes

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

| Error code (errorcode) | Error message (errmsg)                                                            | Solution                                                                                                                                                                    |
| ---------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 40056                  | Invalid agentid                                                                   | Verify that the agentId is correct.                                                                                                                                         |
| 40035                  | Invalid parameter                                                                 | Verify that the taskId is correct.                                                                                                                                          |
| 41052                  | Too many recipients in this delivery; sending results will no longer be returned. | - Reduce the number of recipients for the work notification. - Check whether the work notification has finished sending. This error occurs if sending is still in progress. |
| 500                    | System error                                                                      | An unknown system error occurred.                                                                                                                                           |
