# Search document

This API is used to search for a file based on a search key. 

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/suite/docs-api/search/object
HTTP Method | POST
Required scopes<br>**The scopes required to call this API. You can call the API with any of the scopes.** | View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, and download all files in My Space(drive:drive:readonly)<br>Enable this permission to search for documents to which the user has access.(search:docs:read)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | Authenticate the caller's identity through the access token. Optional values:<br>- `user_access_token`: User authorization credential. The application acts on behalf of the user to perform corresponding operations. Example value: "Bearer u-7f1bcd13fc57d46bac21793aabcef"<br>For more information, refer to [Obtaining Access Tokens](https://open.feishu.cn/document/ukTMukTMukTM/uMTNz4yM1MjLzUzM).
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Request body

Parameter | Type | Required | Description
---|---|---|---
search_key | string | Yes | Specifies the keyword for the search.
count | int | No | Specifies the number of files to return from the search. The range is [0,50].
offset | int | No | Specifies the offset for the search, with a minimum value of 0 (no offset). The sum of this value and the number of files returned must be less than or equal to 200 (i.e., offset + count < 200).
owner_ids | list&lt;string&gt; | No | The Open IDs of the file owners. For more information, see [How to get Open ID](https://open.feishu.cn/document/home/user-identity-introduction/open-id).
chat_ids | list&lt;string&gt; | No | The chat_id of the group where the file is located. For more information, see [Group ID description](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-id-description).
docs_types | list&lt;string&gt; | No | Types of files, supporting the following enumerations:<br>- `doc`：Documents. Including earlier and new version of document.<br>- `sheet`：sheet<br>- `slides`：slide<br>- `bitable`：Base<br>- `mindnote`：mindnote<br>- `file`：file

### Request body example
```json
{
    "search_key": "Project",
    "count": 10, 
    "offset": 0,
    "owner_ids": ["13eabcef"],
    "chat_ids": [],
    "docs_types": ["doc", "sheet"]
}
```
## Response
### Response body

Name | Type | Description
---|---|---
docs_entities | docs_entities[] | List of files containing the search keyword.
docs_token | string | Token of the file.
docs_type | string | Type of the file.
title | string | Title of the file.
owner_id | string | Owners of the file.
has_more | boolean | Indicates whether there are more results following the list.
total | int | Total number of files containing the search keyword.

### Response body example

```json
{
    "code": 0,
    "data": {
        "docs_entities": [
            {
                "docs_token": "shtcnLkpxnlYksumuGNZM1abcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Project Progress Weekly Report"
            },
            {
                "docs_token": "shtcnHO7UvaulkYDXCyQraabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Top 10 Project Management Templates"
            },
            {
                "docs_token": "shtcnO2W1D0YqKZ5TY9z3Cabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Project Gantt Chart"
            },
            {
                "docs_token": "shtcnGVvAVJdohCOnmQvMNabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Weekly Work Plan"
            },
            {
                "docs_token": "shtcnwdKlAT243SF95pokXabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Interview Records"
            },
            {
                "docs_token": "shtcnfgRI0jwwY0ISPSlRlabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Monthly Work Plan"
            },
            {
                "docs_token": "shtcnfsEaTYMVTwT0DbNolabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Team File Repository"
            },
            {
                "docs_token": "shtcn3grVqPADzPt08RiFnabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Expense Reimbursement Form"
            },
            {
                "docs_token": "shtcne3WuFpvRbSsG3SLL7abcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Expense Budget Sheet"
            },
            {
                "docs_token": "IVGMsOakbhd96It63kkc3aabcef",
                "docs_type": "sheet",
                "owner_id": "ou_b97fbe610114d9489ff3b501a71abcef",
                "title": "Team Building Schedule"
            }
        ],
        "has_more": true,
        "total": 59
    },
    "msg": "success"
}

```
### Error code

For details, refer to [Server-side error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

