# List document version

Get all versions of the document. The document can be Feishu document or spreadsheet.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/drive/v1/files/:file_token/versions
HTTP Method | GET
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, and delete document versions(drive:drive:version)<br>View document versions(drive:drive:version: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)

### Path parameters

Parameter | Type | Description
---|---|---
file_token | string | parent document token. For how to get the document token. see [How to get the token of docs resources](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#08bb5df6).<br>**Example value**: "doxbcyvqZlSc9WlHvQMlSJabcef"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
page_size | int | Yes | **Example value**: 20<br>**Data validation rules**:<br>- Maximum value: `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**: 1665739388
obj_type | string | Yes | document type<br>**Example value**: docx<br>**Optional values are**:<br>- docx：Upgraded Docs<br>- sheet：Spreadsheet
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)

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
items | version\[\] | document version list
name | string | title
version | string | version ID
parent_token | string | Parent document token
owner_id | string | document version owner ID
creator_id | string | document version creator ID
create_time | string | document version create time
update_time | string | document version update time
status | string | document version status<br>**Optional values are**:<br>- 0：exist status<br>- 1：deleted status<br>- 2：trash status
obj_type | string | document version type<br>**Optional values are**:<br>- docx：Upgraded Docs<br>- sheet：Spreadsheet
parent_type | string | parent document token<br>**Optional values are**:<br>- docx：Upgraded Docs<br>- sheet：Spreadsheet
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": [
            {
                "name": "project document version 1",
                "version": "fnJfyX",
                "parent_token": "doxbcyvqZlSc9WlHvQMlSJabcef",
                "owner_id": "694699009591869450",
                "creator_id": "694699009591869451",
                "create_time": "1660708537",
                "update_time": "1660708537",
                "status": "0",
                "obj_type": "docx",
                "parent_type": "docx"
            }
        ],
        "page_token": "CISAiM6u8vGzZhCTj5+zBhgB",
        "has_more": true
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
403 | 1068400 | Has no permission, please apply the file permission of reading or edition. | Please apply the file permission of reading or edition.
400 | 1068401 | Review no pass, the title has illegal content. | Please rename the title of document version.
404 | 1068404 | Parent file does not exist, please check the file status. | Please check the file status.
400 | 1068410 | Params error, param [file_token] is wrong. | Please check the `file_token` param.
400 | 1068411 | Params error, param [obj_type] is wrong. | Please check the `obj_type` param.
400 | 1068425 | Request failed, please contact the engineer-https://applink.feishu.cn/TLJsX982. | Please contact the technical support.
400 | 1068412 | Params error, param [version_id] is wrong. | Please check the `version_id` param.

