# Upload a material in blocks-Completing

After calling the [Uploading](ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_part) interface to upload all the shards, you need to call this interface to trigger the completion of the upload. For a complete understanding of the shard upload process, refer to [Media overview](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction).

## Limitation

This API's call frequency limit is 5 QPS, 10,000 times/day.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/drive/v1/medias/upload_finish
HTTP Method | POST
Rate Limit | [Special Rate Limit](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, comment, edit and manage Base(bitable:app)<br>View, comment, edit, and manage Docs(docs:doc)<br>Upload image and file to document(docs:document.media:upload)<br>View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, edit, and manage Sheets(sheets:spreadsheet)

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

For more information about how to call the AccessToken in the Docs API, see [Get started with the Docs API](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN).

### Request body

Parameter | Type | Required | Description
---|---|---|---
upload_id | string | Yes | The ID of the block upload transaction. Obtain this by calling the [Preupload](ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_prepare) interface.<br>**Example value**: "7111211691345512356"
block_num | int | Yes | The number of blocks. Obtain this by calling the [Preupload media](ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_prepare) interface.<br>**Example value**: 1

### Request body example
```json
{
    "upload_id": "7111211691345512356",
    "block_num": 1
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
file_token | string | Token of the new file

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "file_token": "boxcnrHpsg1QDqXAAAyachabcef"
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
200 | 1061001 | internal error. | Internal service error, such as timeout or failure in processing error codes.
400 | 1061002 | params error. | Check whether the request parameters are correct.
404 | 1061003 | not found. | Check whether the resource exists.
403 | 1061004 | forbidden. | Confirm whether the current access identity has permission to read or edit files or folders. Please refer to the following methods to resolve this:<br>- When uploading materials, please ensure that the current caller has edit permissions for the target cloud document.<br>- When uploading files, please ensure that the current caller has edit permissions for the folder.<br>- When performing operations such as adding, deleting, or modifying files or folders, please ensure that the caller has sufficient document permissions:<br>- For the "create file" interface, the caller needs edit permissions for the target folder.<br>- For the "copy file" interface, the caller needs read or edit permissions for the file and edit permissions for the target folder.<br>- For the "move file" interface, the caller must have the following permissions:<br>- Manage permission for the document or folder being moved. <br>- Edit permission for current location of the document or folder.<br>- Edit permission for the new location.<br>- For the "delete file" interface, the caller must have one of the following two permissions:<br>- The app or user is the owner of the file and has edit permissions for the parent folder where the file is located.<br>- The app or user is not the owner of the file, but the owner of the parent folder where the file is located or has full access to the parent folder.<br>For information on how to grant permissions, refer to [How to Grant Permissions for Cloud Document Resources to an App](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-add-permissions-to-app).
401 | 1061005 | auth failed. | Assume the correct user or app mode to access the API.
200 | 1061006 | internal time out. | Internal service timeout. Please try again later.
404 | 1061007 | file has been delete. | Check whether the node has been deleted.
400 | 1061008 | invalid file name. | Check whether the file name has reached the maximum length or is empty.
400 | 1061021 | upload id expire. | The upload transaction has expired. Please upload again.
400 | 1061041 | parent node has been deleted. | Check whether the upload point has been deleted.
400 | 1061042 | parent node out of limit. | The number of materials to upload to the current upload node has reached the limit. Please change the upload point.
400 | 1061043 | file size beyond limit. | Check whether the length of the file is within the limit. For more information, see [File size limits in Drive](https://www.feishu.cn/hc/zh-CN/articles/360049067549).
400 | 1061044 | parent node not exist. | `parent_node` does not exist. Please verify if the upload point token is incorrect:<br>- For the file upload interface, refer to [Folder Token Retrieval Method](https://open.feishu.cn/document/ukTMukTMukTM/ugTNzUjL4UzM14CO1MTN/folder-overview#-717d325) to ensure the correct folder token is provided.<br>- For the media upload interface, refer to [Upload Point Types and Upload Point Token](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/introduction#cc82be3c) to verify if the `parent_node` is correctly filled out.
200 | 1061045 | can retry. | Internal error. Please try again later.
400 | 1061109 | file name cqc not passed. | Make sure that the file to upload and the file name meet compliance.
400 | 1061113 | file cqc not passed. | Make sure that the file to upload and the file name meet compliance.
400 | 1061101 | file quota exceeded. | The tenant has reached the maximum capacity. Make sure that the tenant has sufficient capacity and then upload again.
202 | 1062004 | cover generating. | Generating thumbnails. Please try again later.
202 | 1062005 | file type not support cover. | The system cannot generate thumbnails for this type of file.
202 | 1062006 | cover no exist. | Generating thumbnails. Please try again later.
400 | 1062007 | upload user not match. | Make sure that the current request is sent by the same user or app as the upload task.
400 | 1062008 | checksum param Invalid. | Make sure that the checksum of the file or file block is correct.
400 | 1062009 | the actual size is inconsistent with the parameter declaration size. | The size of the file to transfer is inconsistent with that specified in the parameter.
400 | 1062010 | block missing, please upload all blocks. | Some file blocks are missing. Make sure that all file blocks are uploaded.
400 | 1062011 | block num out of bounds. | The number of file blocks to upload has reached the limit. Make sure that the file blocks belong to the specified file.
400 | 1061547 | attachment parent-child relation number exceed. | The material to upload to Docs has reached the limit.
400 | 1061061 | user quota exceeded. | You have reached your maximum personal capacity. Make sure that you have sufficient capacity and then upload again.
403 | 1061073 | no scope auth. | You have no access to the API.
400 | 1062012 | file copying. | Copying the file.
400 | 1062013 | file damaged. | Failed to copy the file.
403 | 1062014 | dedupe no support. | Instant transfer is not allowed.
400 | 1062051 | client connect close. | Disconnected from the client.
400 | 1062505 | parent node out of size. | The single tree in My Space has reached the maximum size of 400,000.
400 | 1062506 | parent node out of depth. | My Space supports up to 15 levels of directories.
400 | 1062507 | parent node out of sibling num. | The number of nodes mounted to the directory in My Space has reached the limit of **1,500** nodes per level.

