# Search entity

Passing in keywords, performing fuzzy matching to search for corresponding entity words.
**Notice**：In order to better improve the comprehensibility of the interface documentation, we have upgraded the documentation, please migrate to [new version>>](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/lingo-v1/entity/search)

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/baike/v1/entities/search
HTTP Method | POST
Rate Limit | [1000 per minute、50 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom 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 | View, create, edit, and delete Lingo entries(baike:entity)<br>Create and update automatically approved Lingo entries(baike:entity:exempt_review)<br>View Lingo entries(baike:entity:readonly)
Required field scopes | **Notice**：The response body of the API contains the following sensitive fields, and they will be returned only after corresponding scopes are added. If you do not need the fields, it is not recommended that you request the scopes.<br>Obtain user ID(contact:user.employee_id:readonly)

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

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
page_size | int | No | Page size<br>**Example value**: B152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c<br>**Default value**: `20`<br>**Data validation rules**:<br>- Value range: `1` ～ `100`
page_token | string | No | Page identifier. It is not filled in the first request, indicating traversal from the beginning; when there will be more groups, the new page_token will be returned at the same time, and the next traversal can use the page_token to get more groups<br>**Example value**: b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c<br>**Data validation rules**:<br>- Maximum value: `100`
user_id_type | string | No | User ID categories<br>**Example value**: open_id<br>**Optional values are**:<br>- open_id：Identifies a user to an app. The same user has different Open IDs in different apps. [How to get Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- union_id：Identifies a user to a tenant that acts as a developer. A user has the same Union ID in apps developed by the same developer, and has different Union IDs in apps developed by different developers. A developer can use Union ID to link the same user's identities in multiple apps.[How to get Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)<br>- user_id：Identifies a user to a tenant. The same user has different User IDs in different tenants. In one single tenant, a user has the same User ID in all apps （including store apps）. User ID is usually used to communicate user data between different apps. [How to get User ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id)<br>**Default value**: `open_id`<br>**When the value is `user_id`, the following field scopes are required**:<br>Obtain user ID(contact:user.employee_id:readonly)

### Request body

Parameter | Type | Required | Description
---|---|---|---
query | string | No | Search keywords<br>**Example value**: "Lingo"<br>**Data validation rules**:<br>- Length range: `1` ～ `100` characters
classification_filter | classification_filter | No | Classification Filter
include | string\[\] | No | Classification to be obtained<br>**Example value**: ["7195482254012055580"]
exclude | string\[\] | No | Classification to be excluded<br>**Example value**: ["7195482254012055581"]
sources | int\[\] | No | Creation source of the entry, 1: user creation, 2: batch import, 3: official, 4: OpenAPI creation<br>**Example value**: [1]
creators | string\[\] | No | creator<br>**Example value**: ["ou_30b07b63089ea46518789914dac63d36"]

### Request body example
```json
{
    "query": "Lingo",
    "classification_filter": {
        "include": [
            "7195482254012055580"
        ],
        "exclude": [
            "7195482254012055581"
        ]
    },
    "sources": [
        1
    ],
    "creators": [
        "ou_30b07b63089ea46518789914dac63d36"
    ]
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
entities | entity\[\] | Data array
id | string | Entity word Id
main_keys | term\[\] | Key words
key | string | Content
display_status | display_status | Display status
allow_highlight | boolean | Whether to allow highlighting
allow_search | boolean | Whether to allow search
aliases | term\[\] | Alias
key | string | Content
display_status | display_status | Display status
allow_highlight | boolean | Whether to allow highlighting
allow_search | boolean | Whether to allow search
description | string | Definition of entries in plain text format. Note: There must be at least one description and rich_text, otherwise an error will be reported: 1540001
creator | string | creator
create_time | string | create time
updater | string | updater
update_time | string | Last updated time
related_meta | related_meta | Related Resources
users | referer\[\] | Data provider (can not include the horizontal line "-")
id | string | Data ID
title | string | title
url | string | link address
chats | referer\[\] | External id is unique for each entry (cannot contain the horizontal line "-")
id | string | Data ID
title | string | title
url | string | link address
docs | referer\[\] | Associated Document Information
title | string | title
url | string | link
oncalls | referer\[\] | Associated Duty Information
id | string | ID
title | string | title
url | string | link
links | referer\[\] | Associated link information
title | string | title
url | string | link
abbreviations | abbreviation\[\] | Related entry information
id | string | Related other entries id
classifications | classification\[\] | classification information (incoming first-level classification is not supported. Entries cannot belong to multiple sub-categories under the same first-level classification at the same time, and sub-category mutual exclusion under the first-level classification)
id | string | Classifications ID
name | string | Category name
father_id | string | The ID of the parent category
images | baike_image\[\] | Uploaded related pictures
token | string | Image token uploaded through the file interface
statistics | statistics | Description information in rich text format
like_count | int | Lingo is a knowledge management tool provided by Lark. Through the enterprise encyclopedia, it can help enterprises aggregate scattered knowledge information, and promote the preservation and circulation of enterprise knowledge through UGC
dislike_count | int | Number of clicks
outer_info | outer_info | External Data
provider | string | Data provider (cannot contain a dash "-")
outer_id | string | Unique identifier, which can be used to bind with the content of other platforms. It needs to be guaranteed to correspond uniquely to the Baike entry (cannot contain the horizontal line "-")
rich_text | string | Rich text format (when filling in rich text content, the description field will be invalid and may not be filled in), the supported formats refer to the Interpretation section in [Enterprise Baike Guide] (https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/baike-v1/overview)
source | int | Creation source of the entry, 1: user initiative creation, 2: batch import, 3: official word, 4: OpenAPI creation
page_token | string | Page identifier, when has_more is true, a new page_token will also be returned. Otherwise, page_token will not be returned

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "entities": [
            {
                "id": "enterprise_40217521",
                "main_keys": [
                    {
                        "key": "Lingo",
                        "display_status": {
                            "allow_highlight": true,
                            "allow_search": true
                        }
                    }
                ],
                "aliases": [
                    {
                        "key": "Lingo",
                        "display_status": {
                            "allow_highlight": true,
                            "allow_search": true
                        }
                    }
                ],
                "description": "Enterprise Encyclopedia is a knowledge management tool provided by Feishu. Through Enterprise Encyclopedia, it can help enterprises to aggregate scattered knowledge and information, and promote the preservation and circulation of enterprise knowledge through UGC.",
                "create_time": "1627540853",
                "update_time": "1627541853",
                "related_meta": {
                    "abbreviations": [
                        {
                            "id": "enterprise_4450890"
                        },
                        {
                            "id": "enterprise_703481393374354564"
                        },
                        {
                            "id": "enterprise_7036598993106796547"
                        }
                    ],
                    "chats": [
                        {
                            "id": "oc_c13831833eaa8c92c52befa759ea4806"
                        },
                        {
                            "id": "oc_c8161c9109966a24127e73b10233b295"
                        }
                    ],
                    "docs": [
                        {
                            "title": "Guess what you want to ask/FAQs",
                            "url": "https://bytedance.feishu.cn/wiki/wikcnZ8Lq4f9DMCDOtdcIzCUjAh"
                        },
                        {
                            "title": "Getting to know Feishu Docs quickly | Introducing Feishu Docs",
                            "url": "https://bytedance.feishu.cn/docs/doccnxlVCCFjMsJE15I7PLAjIWc"
                        }
                    ],
                    "links": [
                        {
                            "title": "Feishu Official Website",
                            "url": "https://feishu.cn"
                        }
                    ],
                    "oncalls": [
                        {
                            "id": "7023689049445548034"
                        },
                        {
                            "id": "7024063787560910850"
                        }
                    ],
                    "users": [
                        {
                            "id": "ou_30b07b63089ea46518789914dac63d36",
                            "title": "Person in charge"
                        },
                        {
                            "id": "ou_b292c0d285c14754639fa4501e80c36a",
                            "title": ""
                        }
                    ],
                    "classifications": [
                        {
                            "id": "7049606926702837761",
                            "father_id": "7049606926702837777"
                        }
                    ],
                    "images": [
                        {
                            "token": "boxbcEcmKiD3SGHvgqWTpvdc7jc"
                        }
                    ]
                },
                "statistics": {
                    "like_count": 100,
                    "dislike_count": 20
                },
                "outer_info": {
                    "provider": "Nebula",
                    "outer_id": "12345"
                },
                "rich_text": "Enterprise Baike is Feishu A knowledge management tool provided by the enterprise Baike can help enterprises to aggregate scattered knowledge information, and through UGC, Promote the preservation and circulation of corporate knowledge"
            }
        ],
        "page_token": "b152fa6e6f62a291019a04c3a93f365f8ac641910506ff15ff4cad6534e087cb4ed8fa2c"
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1540001 | invalid param | Parameter error, refer to the document to check the input parameters
500 | 1540002 | network anomaly, please try again | Most service requests timed out, please re-request, a few are service exceptions

