# Create a Help Desk chat

This API is used to create a Help Desk chat.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/helpdesk/v1/start_service
HTTP Method | POST
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.** | Access Help Desk(helpdesk:helpdesk:access)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-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"

**Notice**：The "Help Desk token" parameter also needs to be added to the Help Desk request header:

Key: X-Lark-Helpdesk-Authorization

Value: base64(helpdesk_id:helpdesk_token), a base64-encrypted string that connects helpdesk_id and helpdesk_token with ':'.

[Learn more about how to obtain and use Help Desk token](https://open.feishu.cn/document/ukTMukTMukTM/ugDOyYjL4gjM24CO4IjN)

### Request body

Parameter | Type | Required | Description
---|---|---|---
human_service | boolean | No | Specifies whether to enter human agent service directly (required if appointed_agents is entered)<br>**Example value**: false
appointed_agents | string\[\] | No | Agent Open IDs (for how to obtain them, see [Obtain single user information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/get)). human_service should be true.<br>**Example value**: ["ou_7dab8a3d3cdcc9da365777c7ad535d62"]
open_id | string | Yes | User Open ID, (for how to obtain them, see [Obtain single user information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/get).)<br>**Example value**: "ou_7dab8a3d3cdcc9da365777c7ad535d62"
customized_info | string | No | Custom information of the ticket source (at most 1,024 characters). If this field is set, the information will be returned when [Obtain ticket details](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/get) is called.<br>**Example value**: "test customized info"

### Request body example
```json
{
    "human_service": false,
    "appointed_agents": [
        "ou_7dab8a3d3cdcc9da365777c7ad535d62"
    ],
    "open_id": "ou_7dab8a3d3cdcc9da365777c7ad535d62",
    "customized_info": "test customized info"
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
chat_id | string | Open ID of the agent group
ticket_id | string | Created ticket ID(Only manual tickets return this parameter)

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "chat_id": "created-chat-id",
        "ticket_id": "7474857595946745884"
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
500 | 155000 | Internal error | Internal error, please contact us
400 | 154000 | Bad request, please check your request body | Invalid request. Check the parameters.
401 | 154001 | Unauthorized, please check you have the correct access | Check if Authorization and X-Lark-Helpdesk-Authorization are correct and the app and Help Desk belong to the same tenant.
404 | 154004 | Resource not found | Check the ID value.
401 | 154402 | Helpdesk can't be see by user | Helpdesk can't be see by user

