SuperAPI AI Directory

feishu-cli-perm

General & other

View repository

Updated 10-15 16:41

About this skill

Feishu Permission Management Skill

Feishu cloud document permission management: add/update/delete/view collaborators, public permission management, sharing passwords, batch adding, permission checking, transfer ownership.

Applicable Scenarios

  • Add/update/delete collaborator permissions for Feishu documents
  • View document collaborator list
  • Manage document public permissions (external access, link sharing)
  • Set/refresh/delete sharing passwords
  • Batch add collaborators
  • Check a user's permissions on a document
  • Transfer document ownership

Prerequisites

Installation and Authentication

  • feishu-cli: If not yet installed, please go to riba2534/feishu-cli to get the installation method
  • Authentication: Use App Token (app identity), requires configuring App ID and App Secret (environment variables or ~/.feishu-cli/config.yaml). No auth loginrequired (User Token is not applicable to permission management APIs).

Required permission scopes

scope Description
docs:permission.member:create Add collaborators
docs:permission.member:retrieve View collaborator list
docs:permission.member:update Update collaborator permissions
docs:permission.member:delete Delete collaborators
docs:permission.member:transfer Transfer ownership
docs:permission.member:auth Check user permissions
docs:permission.setting:read / docs:permission.setting:readonly Read public permission settings
docs:permission.setting:write_only Update public permissions, password management

Quick Start

# 给用户添加编辑权限(最常用操作)
feishu-cli perm add <TOKEN> --doc-type docx --member-type email --member-id user@example.com --perm edit --notification

# 查看文档协作者列表
feishu-cli perm list <TOKEN> --doc-type docx

# 删除指定协作者
feishu-cli perm delete <TOKEN> --doc-type docx --member-type email --member-id user@example.com

Command Overview

I. Basic Operations

Command Description
perm add Add collaborator permissions
perm update Update the permission level of an existing collaborator
perm list View collaborator list
perm delete Delete collaborators

II. Advanced Operations

Command Description
perm batch-add Batch add collaborators from a JSON file
perm transfer-owner Transfer document ownership
perm auth Check the current user's permissions on a document

III. Public Settings

Command Description
perm public-get View document public permission settings
perm public-update Update public permissions (external access, link sharing, etc.)
perm password create Create sharing password
perm password update Refresh sharing password
perm password delete Delete sharing password

Command Details

Add Permission

feishu-cli perm add <TOKEN> \
  --doc-type <DOC_TYPE> \
  --member-type <MEMBER_TYPE> \
  --member-id <MEMBER_ID> \
  --perm <PERM> \
  [--notification]

Update Permission

feishu-cli perm update <TOKEN> \
  --doc-type <DOC_TYPE> \
  --member-type <MEMBER_TYPE> \
  --member-id <MEMBER_ID> \
  --perm <PERM>

View Collaborator List

feishu-cli perm list <TOKEN> --doc-type <DOC_TYPE>

Delete Collaborators

feishu-cli perm delete <TOKEN> \
  --doc-type <DOC_TYPE> \
  --member-type <MEMBER_TYPE> \
  --member-id <MEMBER_ID>

Batch Add Collaborators

feishu-cli perm batch-add <TOKEN> \
  --doc-type <DOC_TYPE> \
  --members-file <members.json> \
  [--notification]

--doc-type Default docx, non-docx documents (sheet / bitable / file / wiki / slides, etc.) must be explicitly specified, otherwise they will be processed as docx and cause API errors.

members.json format (top level is a JSON array):

[
  {"member_type": "email", "member_id": "user1@example.com", "perm": "edit"},
  {"member_type": "email", "member_id": "user2@example.com", "perm": "view"}
]

Transfer Ownership

feishu-cli perm transfer-owner <TOKEN> \
  --member-type <MEMBER_TYPE> \
  --member-id <MEMBER_ID> \
  [--notification] \
  [--remove-old-owner] \
  [--stay-put] \
  [--old-owner-perm <view|edit|full_access>]
Parameter Default Value Description
--notification true Notify the new owner
--remove-old-owner false Remove the original owner's permissions
--stay-put false Keep the document in its original location
--old-owner-perm full_access Original owner retains permission (only effective when remove-old-owner=false)

Permission Check

feishu-cli perm auth <TOKEN> --action <ACTION> [--doc-type <DOC_TYPE>]

Available action values:view、edit、share、comment、export

View public permission

feishu-cli perm public-get <TOKEN>

Update public permission

feishu-cli perm public-update <TOKEN> \
  [--external-access] \
  [--link-share-entity <anyone_readable|anyone_editable|...>]

Share password management

feishu-cli perm password create <TOKEN> [--doc-type <DOC_TYPE>]
feishu-cli perm password update <TOKEN> [--doc-type <DOC_TYPE>]
feishu-cli perm password delete <TOKEN> [--doc-type <DOC_TYPE>]

Parameter Description

perm (permission level)

Value Description Use Case
view View permission Read-only sharing with external personnel or large-scale sharing, protecting the document from accidental modification
edit Edit permission Team collaborative editing, the most commonly used permission level in daily work
full_access Full access permission Administrator permission, including all capabilities such as managing collaborators, document settings, export, and viewing historical versions

member-type (collaborator ID type)

Value Alias (IM style) Description Use Case Example
email — Email Most commonly used, precise to the individual user@example.com
openid open_id Open ID User ID obtained through the open platform ou_xxx
userid user_id User ID Enterprise internal user ID 123456
unionid union_id Union ID Cross-application unified ID on_xxx
openchat chat_id Group chat ID Authorize by group chat, all members in the group get permission oc_xxx
opendepartmentid — Department ID Authorize by department, all members in the department get permission od_xxx
groupid — Group ID User group gc_xxx
wikispaceid — Knowledge space ID Knowledge base space ws_xxx

IM API style aliases (open_id、user_id、union_id、chat_id) are automatically mapped to standard values; the two forms are equivalent.

doc-type (cloud document type)

Value Description
docx New document (default)
doc Old document
sheet Spreadsheet
bitable Base
wiki Wiki
file File
folder Folder
mindnote Mind note
minutes Minutes
slides Slides

Token prefix correspondence

Prefix doc-type
docx_ docx
doccn doc
sht_ sheet
bascn bitable
wikicn wiki
fldcn folder

Example

Add user as editor by email

feishu-cli perm add docx_xxxxxx \
  --doc-type docx \
  --member-type email \
  --member-id user@example.com \
  --perm edit \
  --notification

Update existing permission to full access

feishu-cli perm update docx_xxxxxx \
  --doc-type docx \
  --member-type email \
  --member-id user@example.com \
  --perm full_access

Add edit permission to a group chat

feishu-cli perm add sht_xxxxxx \
  --doc-type sheet \
  --member-type openchat \
  --member-id oc_xxxxxx \
  --perm edit

Add view permission by department

feishu-cli perm add sht_xxxxxx \
  --doc-type sheet \
  --member-type opendepartmentid \
  --member-id od_xxxxxx \
  --perm view

Transfer ownership and retain view permission for the original owner

feishu-cli perm transfer-owner docx_xxxxxx \
  --member-type email \
  --member-id user@example.com \
  --old-owner-perm view

Set document to "anyone with the link can read"

feishu-cli perm public-update docx_xxxxxx \
  --external-access \
  --link-share-entity anyone_readable

Standard authorization process after creating a document

# 1. 授予完全访问权限
feishu-cli perm add <TOKEN> \
  --doc-type docx \
  --member-type email \
  --member-id user@example.com \
  --perm full_access \
  --notification

# 2. 转移文档所有权
feishu-cli perm transfer-owner <TOKEN> \
  --doc-type docx \
  --member-type email \
  --member-id user@example.com \
  --notification

Troubleshooting

Error Cause Solution
Permission denied / Insufficient permission The App has not been granted the relevant permission scope Apply for docs:permission.member:create and other permissions in Feishu Open Platform -> Permission Management
doc-type mismatch / Invalid token doc-type does not match the actual document type Check the Token prefix:docx_ -> docx、sht_ -> sheet、bascn -> bitable
member not found member-id does not exist or member-type is incorrect Confirm that the email/ID is correct; note that the email type requires the user's Feishu registered email
password create: Permission denied Share password is an Enterprise edition feature Confirm whether the enterprise has enabled this feature, or contact the administrator to enable it
transfer-owner: no permission Only the document owner or administrator can transfer First use perm list to confirm the current App identity and ensure you are the document creator

Reference documentation

perm add For the detailed parameter enumeration and input checklist of the command, see references/add_permission.md。