# Verify instances

Call this interface to verify third-party approval instance data, used to determine whether server-side data is up to date. Submit the latest update time of the instance when making the request. If the server does not have the instance or the instance update time on the server is not the latest, the corresponding instance ID will be returned.

For example, set a timed task every 5 minutes to compare the instances generated in the past 5 minutes using this interface. If the data does not exist on the server or is not the latest, you can go to [synchronize third-party approval instance](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/external_instance/create) based on the instance ID and task ID returned by this interface.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/approval/v4/external_instances/check
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, create, update, and delete info of Approval app(approval:approval)<br>Access Approval(approval:approval:readonly)<br>View, create, update, and delete info in third-party approval instance(approval:external_instance)

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

### Request body

Parameter | Type | Required | Description
---|---|---|---
instances | exteranl_instance_check\[\] | Yes | Instance information
instance_id | string | Yes | Approval instance ID. Custom configuration needs to ensure uniqueness within the current enterprise and application.<br>**Note**: When calling this interface and the [synchronize third-party approval instance](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/external_instance/create) interface for the same third-party approval instance, it is necessary to ensure that the instance ID used is consistent.<br>**Example value**: "1234234234242423"
update_time | string | Yes | Latest update time of the approval instance, Unix millisecond timestamp.<br>**Example value**: "1591603040000"
tasks | external_instance_task\[\] | Yes | Task information
task_id | string | Yes | Approval task ID within the approval instance. Custom configuration needs to ensure uniqueness within the current enterprise and application.<br>**Note**: When calling this interface and the [synchronize third-party approval instance](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/external_instance/create) interface for tasks within the same third-party approval instance, it is necessary to ensure that the task ID used is consistent.<br>**Example value**: "112253"
update_time | string | Yes | Latest update time of the task, Unix millisecond timestamp.<br>**Example value**: "1591603040000"

### Request body example
```json
{
    "instances": [
        {
            "instance_id": "1234234234242423",
            "update_time": "1591603040000",
            "tasks": [
                {
                    "task_id": "112253",
                    "update_time": "1591603040000"
                }
            ]
        }
    ]
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
diff_instances | exteranl_instance_check_response\[\] | Instance information with inconsistent update times
instance_id | string | Approval instance ID
update_time | string | Latest update time of the task, Unix millisecond timestamp.
tasks | external_instance_task\[\] | Task information
task_id | string | Task id
update_time | string | Latest update time of the task, Unix millisecond timestamp.

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "diff_instances": [
            {
                "instance_id": "1234234234242423",
                "update_time": "1591603040000",
                "tasks": [
                    {
                        "task_id": "112253",
                        "update_time": "1591603040000"
                    }
                ]
            }
        ]
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1390001 | param is invalid | Parameter error. Troubleshooting steps:<br>- Check the parameters passed during the request according to the parameter descriptions in the API documentation.<br>- If form parameters are passed, verify whether the form control data within the parameters is correct. If the error message includes a control ID (e.g., `Control= widget17261088448220001`), you can call the [View specific approval definition](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/approval/get) or [Get single approval instance details](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/approval-v4/instance/get) API to retrieve the response parameter form value, search for the problematic control ID, and check whether the configuration of the control is correct.
400 | 1395001 | There have been some errors. Please try again later | Troubleshooting steps for service errors:<br>1. Refer to the parameter descriptions in the API documentation and check whether the parameters passed in the request are correct. If form parameters are passed (form), check whether the form control data passed in is correct.<br>2. Reduce the request frequency and retry. If the error persists after retrying, please contact [Technical Support](https://applink.feishu.cn/TLJpeNdW).

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

