# Update calendar information

Call this interface with the current identity (application or user) to modify the title, description, public range, and other information of the specified calendar.

**Notice**：- The current identity is determined by the Token type of Header Authorization. Tenant_access_token refers to the application identity, user_access_token refers to the user identity.
- If you call this interface using the application identity, you need to ensure that the application has [Bot capabilities](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability).
- If the current identity has the owner access permission of the calendar, all the properties of the calendar can be updated (including globally effective summary, description, permission and color, summary_alias that only take effect for the current identity). 
- If the current identity does not have the owner access permission of the calendar, only the color and summary_alias effective for the current identity can be updated.You can call the [query calendar information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get) interface to check the access permissions of the current identity to the calendar.
- Room calendar do not support setting alias

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/calendar/v4/calendars/:calendar_id
HTTP Method | PATCH
Rate Limit | [1000 per minute、50 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.**<br>Enable any scope from the list | Update calendar and event information(calendar:calendar)<br>Update calendar(calendar:calendar:update)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>or<br>`user_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Path parameters

Parameter | Type | Description
---|---|---
calendar_id | string | Calendar ID. <br>When creating a shared calendar, the calendar ID will be returned. You can also call the following interfaces to get the ID of a calendar.<br>- [Query Primary Calendar Information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/primary)<br>- [Query Calendar List](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/list)<br>- [Search Calendars](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/search)<br>**Example value**: "feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn"

### Request body

Parameter | Type | Required | Description
---|---|---|---
summary | string | No | Calendar title.<br>- Not providing this field means it will not be updated.<br>**Example value**: "Test calendar"<br>**Data validation rules**:<br>- Length range: `1` ～ `255` characters
description | string | No | Calendar description.<br>- Not providing this field means it will not be updated.<br>**Example value**: "Create a calendar by calling an open API"<br>**Data validation rules**:<br>- Maximum length: `255` characters
permissions | string | No | Calendar visibility range.<br>- Not providing this field means it will not be updated.<br>**Example value**: "private"<br>**Optional values are**:<br>- private：Private<br>- show_only_free_busy：Only availability information is displayed.<br>- public：Public. Event details are visible to other people
color | int | No | Calendar color, the value is represented by the int32 of the RGB color value, where, 24 ~ 31 bits are transparency, 16 ~ 23 bits are red, 8 ~ 15 bits are green, 0 ~ 7 bits are blue. For example, -11034625 represents the RGB value (87, 159, 255).<br>- Not providing this field means it will not be updated.<br>**Note**:<br>- The value range is  -2^31 ~ 2^31-1<br>- The color of the calendar will be mapped to the closest color on the Feishu client palette for display.<br>- This color only applies to the current identity.<br>**Example value**: -1
summary_alias | string | No | Calendar alias, setting this field (including subsequent modification of this field) only takes effect for the current identity.<br>- Not providing this field means it will not be updated.<br>**Example value**: "Calendar alias"<br>**Data validation rules**:<br>- Maximum length: `255` characters

### Request body example
```json
{
    "summary": "Test calendar",
    "description": "Create a calendar by calling an open API",
    "permissions": "private",
    "color": -1,
    "summary_alias": "Calendar alias"
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
calendar | calendar | Updated calendar entity
calendar_id | string | Calendar ID. Subsequent queries, updates or deletions of calendar information can be made through this ID. For details, see [Calendar-related IDs](https://open.feishu.cn/document/ukTMukTMukTM/uETM3YjLxEzN24SMxcjN#f066a96c).
summary | string | Calendar title.
description | string | Calendar description.
permissions | string | Calendar visibility range.<br>**Optional values are**:<br>- private：Private<br>- show_only_free_busy：Only availability information is displayed.<br>- public：Public. Event details are visible to other people
color | int | Calendar color, represented by the int32 of the RGB value of the color. When actually displayed on the client, it will be mapped to the color that is closest on the color palette, and this field only takes effect for the current identity.
type | string | Calendar type.<br>**Optional values are**:<br>- unknown：Unknown type<br>- primary：Primary calendar of the user or app<br>- shared：Shared calendar created by the user or app<br>- google：Google calendar connected to the user<br>- resource：Room calendar<br>- exchange：Exchange calendar connected to the user
summary_alias | string | Calendar alias, which only takes effect for the current identity.
is_deleted | boolean | Whether the calendar has been marked as deleted for the current identity.
is_third_party | boolean | Whether the calendar is owned by a third party. Third-party calendars and events are read-only.
role | string | Current identity's access to the calendar.<br>**Optional values are**:<br>- unknown：Unknown access.<br>- free_busy_reader：Guest. A guest can only view availability information.<br>- reader：Subscriber. A subscriber can view all event details.<br>- writer：Editor. An editor can create and modify events.<br>- owner：Administrator. An administrator can manage calendars and share settings.

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "calendar": {
            "calendar_id": "feishu.cn_xxxxxxxxxx@group.calendar.feishu.cn",
            "summary": "Test calendar",
            "description": "Create a calendar by calling an open API",
            "permissions": "private",
            "color": -1,
            "type": "shared",
            "summary_alias": "Calendar alias",
            "is_deleted": false,
            "is_third_party": false,
            "role": "owner"
        }
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 190002 | invalid parameters in request | Invalid request parameters. Troubleshooting suggestions are as follows:<br>- Confirm that the field name and parameter type of the request parameter are correct.<br>- Confirm that the permissions for the corresponding resource have been applied for.<br>- Confirm that the corresponding resource has not been deleted.
500 | 190003 | internal service error | Internal service error, please contact [Technical Support](https://applink.feishu.cn/TLJpeNdW).
429 | 190004 | method rate limited | Method frequency limit. It is recommended to try again later and reduce the request QPS appropriately.
429 | 190005 | app rate limited | Frequency limiting is applied. We recommend that you try again later and reduce the request QPS appropriately.
403 | 190006 | wrong unit for app tenant | Request error, check whether the App ID and App Secret are correct. If the problem still cannot be solved, please consult [Technical Support](https://applink.feishu.cn/TLJpeNdW).
404 | 190007 | app bot_id not found | The bot_id of the application is not found. You need to make sure that the application has enabled [bot capability](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability). If the problem is still not solved, please contact [technical support](https://applink.feishu.cn/TLJpeNdW).
429 | 190010 | current operation rate limited | The current operation is limited, usually because concurrent preemption of public resources fails. You can appropriately reduce the frequency of the current operation and try again.
400 | 190014 | invalid request parameters. check details for more info. | Invalid request parameters. Please check the details for more information.
404 | 191000 | calendar not found | Calendar not found. You need to check and change to the correct calendar ID.
400 | 191001 | invalid calendar_id | The calendar_id is invalid. You need to check and change it to the correct calendar ID.
403 | 191002 | no calendar access_role | The current identity does not have permission to access the calendar. If you want to query a calendar, you need to ensure that the current identity has permission to access the calendar.
403 | 191003 | calendar is deleted | The calendar has been deleted. You need to check and change to the correct calendar ID.
403 | 191004 | invalid calendar type | The calendar type is incorrect. You can call the [query calendar information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get) interface to obtain the calendar type information, and then ensure that the calendar type is applicable to the current interface.
400 | 191009 | non-subscriber cannot modify the calendar | The current identity is not a calendar owner and has not subscribed to the calendar, so it cannot modify calendar information.
404 | 195100 | user is dismiss or not exist in the tenant | The current identity or specified user has resigned or is no longer in the tenant. Please check and change to the correct identity to call the interface.

For more error code information, see [General error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

