# Search contract

This interface can be used to search for contract information, including contract start time, contract expected end time, contract actual end time, contract company entity, etc.
**Notice**：The interface will return data according to the permission scope of "employee resources" owned by the application. Please make sure that the permission scope of "employee resources" has been applied in "Developer Background - Rights Management - Data Rights".

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/corehr/v2/contracts/search
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.**<br>Enable any scope from the list | View contract(corehr:contract:read)<br>Create, update, and delete contract(corehr:contract:write)
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>Get information of contracting parties(corehr:contract.company:read)<br>Get employee's employment contract period(corehr:contract.period:read)<br>Read and write information of contracting parties(corehr:contract.company:write)<br>Obtain user ID(contact:user.employee_id:readonly)<br>Read and write employee's employment contract period(corehr:contract.period:write)

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

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
page_size | int | Yes | Page size, up to 100<br>**Example value**: 100<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**: 6891251722631890445
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><md-enum-item key="people_corehr_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
---|---|---|---
employment_id_list | string\[\] | No | Employment ID List, you can get ID by[[Get Employment Infomation]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/employee/batch_get)<br>**Example value**: ["7140964208476371111"]
contract_id_list | string\[\] | No | Contract ID List, which can be obtained through [[Get contract list]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/contract/list)<br>**Example value**: ["7140964208476372134"]

### Request body example
```json
{
    "employment_id_list": [
        "7140964208476371111"
    ],
    "contract_id_list": [
        "7140964208476372134"
    ]
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
items | contract\[\] | Query contract information
id | string | Contract ID
effective_time | string | Contract start date<br>**Required field scopes (Satisfy any)**:<br>Get employee's employment contract period(corehr:contract.period:read)<br>Read and write employee's employment contract period(corehr:contract.period:write)
contract_end_date | string | Contract end date<br>**Required field scopes (Satisfy any)**:<br>Get employee's employment contract period(corehr:contract.period:read)<br>Read and write employee's employment contract period(corehr:contract.period:write)
expiration_time | string | Actual end date<br>**Required field scopes (Satisfy any)**:<br>Get employee's employment contract period(corehr:contract.period:read)<br>Read and write employee's employment contract period(corehr:contract.period:write)
employment_id | string | Employment ID
contract_type | enum | Contract type can be obtained through the document [[Feishu CoreHR enumeration constants]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)contract_type enumeration definition section
enum_name | string | Enumeration value
display | i18n\[\] | Enumerated multilingual display
lang | string | Language
value | string | Content
first_party_company_id | string | Company ID, Company Info can be obtained through the document [[Get company by ID]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/company/get)<br>**Required field scopes (Satisfy any)**:<br>Get information of contracting parties(corehr:contract.company:read)<br>Read and write information of contracting parties(corehr:contract.company:write)
person_id | string | Personal Information ID. Person Info can be obtained through the document [[Get personal information by ID]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/person/get)
duration_type | enum | Duration type can be obtained through the document [[Feishu CoreHR enumeration constants]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)duration type enumeration definition section
enum_name | string | Enumeration value
display | i18n\[\] | Enumerated multilingual display
lang | string | Language
value | string | Content
contract_number | string | Contract ID
signing_type | enum | Signing type can be obtained through the document [[Feishu CoreHR enumeration constants]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)signing type enumeration definition section
enum_name | string | Enumeration value
display | i18n\[\] | Enumerated multilingual display
lang | string | Language
value | string | Content
contract_status | enum | Contract agreement status, the emuneration value can be obtained through the contract term type (contract_status) enumeration definition section of the document [[Feishu Personnel Enumeration Constants]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)
enum_name | string | Enumeration value
display | i18n\[\] | Enumeration multilingual display
lang | string | Language
value | string | Content
renewal_status | enum | Renewal status, the emuneration value can be obtained through the contract term type (renewal_status) enumeration definition section of the document [[Feishu Personnel Enumeration Constants]](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/feishu-people-enum-constant)
enum_name | string | Enumeration value
display | i18n\[\] | Enumeration multilingual display
lang | string | Language
value | string | Content
signing_times | int | Signing times
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
has_more | boolean | Whether the response body has more parameters

### Response body example
```json
{
    "code": 0,
    "msg": "Success",
    "data": {
        "items": [
            {
                "id": "7147527056140813828",
                "effective_time": "2023-01-01 00:00:00",
                "contract_end_date": "2024-01-01",
                "expiration_time": "2023-11-01 00:00:00",
                "employment_id": "6893014062142064135",
                "contract_type": {
                    "enum_name": "fixed_term",
                    "display": [
                        {
                            "lang": "zh-CN",
                            "value": "Zhang San"
                        }
                    ]
                },
                "first_party_company_id": "7091599096804394540",
                "person_id": "7088589447189022252",
                "duration_type": {
                    "enum_name": "fix_term",
                    "display": [
                        {
                            "lang": "zh-CN",
                            "value": "Zhang San"
                        }
                    ]
                },
                "contract_number": "0000011",
                "signing_type": {
                    "enum_name": "new",
                    "display": [
                        {
                            "lang": "zh-CN",
                            "value": "Zhang San"
                        }
                    ]
                },
                "contract_status": {
                    "enum_name": "phone_type",
                    "display": [
                        {
                            "lang": "zh-CN",
                            "value": "张三"
                        }
                    ]
                },
                "renewal_status": {
                    "enum_name": "phone_type",
                    "display": [
                        {
                            "lang": "zh-CN",
                            "value": "张三"
                        }
                    ]
                },
                "signing_times": 1
            }
        ],
        "page_token": "eVQrYzJBNDNONlk4VFZBZVlSdzlKdFJ4bVVHVExENDNKVHoxaVdiVnViQT0=",
        "has_more": true
    }
}
```

