# Transfer owner

This API is used to transfer a document owner based on file token and user information.

**Notice**：After the file transfer owner under the personal folder is completed, it will be moved to the new owner's space by default

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/drive/v1/permissions/:token/members/transfer_owner
HTTP Method | POST
Rate Limit | [100 per minute](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, edit, and manage Wiki(wiki:wiki)<br>View, comment, edit, and manage Docs(docs:doc)<br>Transfer ownership of document(docs:permission.member:transfer)<br>View, comment, edit, and manage all files in My Space(drive:drive)<br>View, comment, edit, and manage Sheets(sheets:spreadsheet)<br>View, comment, edit, and manage Base (In Suite)(bitable:bitable)

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

### Path parameters

Parameter | Type | Description
---|---|---
token | string | Token of the file. For more information about how to obtain the token, see [How to get the token of docs resources](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#036e0b0f).<br>**Example value**: "doccnBKgoMyY5OMbUG6FioTXuBe"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
type | string | Yes | File type, which needs to match the token of the file<br>**Example value**: doc<br>**Optional values are**:<br>- doc：Doc<br>- sheet：Sheet<br>- file：File in My Space<br>- wiki：Wiki node<br>- bitable：Bitable<br>- docx：Upgraded Docs<br>- mindnote：Thinking Notes<br>- minutes：Minutes<br>- slides：slides<br>- folder：Folder
need_notification | boolean | No | If the value is true, the new owner is not notified. The default value is true<br>**Example value**: true<br>**Default value**: `true`
remove_old_owner | boolean | No | If the value is true, the permissions of the previous owner are deleted after the owner is transferred. The default value is false<br>**Example value**: false<br>**Default value**: `false`
stay_put | boolean | No | This parameter will only take effect if the file is in a personal folder. If set to false, the system will move the content to the new owner's space. If set to true, it stays in place.<br>**Example value**: false<br>**Default value**: `false`
old_owner_perm | string | No | This parameter takes effect only when remove_old_owner = false, retaining the permissions role specified by the original file owner<br>**Example value**: view<br>**Default value**: `full_access`

### Request body

Parameter | Type | Required | Description
---|---|---|---
member_type | string | Yes | Collaborator type, which needs to match the collaborator id<br>**Example value**: "openid"<br>**Optional values are**:<br>- email：email<br>- openid：openid<br>- userid：userid
member_id | string | Yes | Collaborator id, which needs to match the collaborator type<br>**Example value**: "string"

### Request body example
```json
{
    "member_type": "openid",
    "member_id": "string"
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-

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

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 1063001 | Invalid parameter | The parameter is abnormal, which may be due to the following reasons:<br>- The parameter types do not match, for example, the token and type of the document do not match.<br>- Abnormal parameter filling, such as token or type filling, which does not meet the requirements of the document.
403 | 1063002 | Permission denied | The user or application associated with the calling identity is not a [collaborator](https://www.feishu.cn/hc/en-US/articles/064037224266-introduction-to-document-and-folder-collaborators) of the cloud document or lacks sufficient permissions (such as editing or management rights) for the document. Please follow the methods below to resolve this issue:<br>- For the transfer ownership interface, you must ensure that the calling identity is the owner of the cloud document.<br>- For interfaces related to collaborators and permission settings, first refer to [Who can view, add, or remove collaborators](https://www.feishu.cn/hc/en-US/articles/360049067527-set-share-copy-download-and-comment-permissions-for-documents#tabs0|lineguid-QZmNr) to understand the current permission settings of the cloud document, then grant the required permissions to the calling identity:<br>- If you are using a `tenant_access_token`, add the necessary permissions for the application via the cloud document's web page by selecting **“...”** in the top-right corner -> **“…More”** -> **"Add Document Application"**.<br>![](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/bb60f97ebb402475f2af1d3131d4914f_sLOzoqYRXX.png?height=1992&maxWidth=550&width=3278)<br>**Note**:<br>- Before **adding the document application**, ensure that the target application has at least one [API permission](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/scope-list) for the cloud document or Base (multi-dimensional table). Otherwise, you won't be able to find the target application in the document application window.<br>- If the Base is configured with advanced permissions, you must add management permission for the application.<br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/95bc56b2990541ad83cc65ddaa6d1e3a_V24oiRrz7V.png?maxWidth=550)<br>- If you are using a `user_access_token`, add permissions for the current user via the **Share** option on the top-right corner of the cloud document's web page.<br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/caceea2ac91c170555194d7a8dc2a317_GfTRc9xLAt.png)<br>For detailed steps or other methods to add permissions, refer to [Cloud Document FAQs 3](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#16c6475a).
400 | 1063003 | Invalid operation | Illegal operation, which may be due to the following reasons: <br>- The number of collaborators has reached the upper limit. <br>- Modify cloud document permission settings but cannot be modified due to enterprise control.
403 | 1063004 | User has no share permission | The user does not have sharing permissions, please confirm whether the calling identity has sharing permissions for the document.
404 | 1063005 | Resource is deleted | The resource has been deleted, please confirm that the cloud document still exists.
429 | 1063006 | Too many request | Request frequency limit, please reduce the request frequency and try again later.
500 | 1066001 | Internal Error | Internal service error, such as timeout or failure in processing error codes.
500 | 1066002 | Concurrency error, please retry | Internal service error. Please try again.

