Create, read, update, and search cloud documents with Lark-flavored Markdown. Insert media, manage whiteboards, and download resources — all from the command line or through AI Agent automation.
The Feishu CLI document module provides 6 shortcut commands for comprehensive cloud document control. Every shortcut maps directly to the Lark Open Platform Docs API via MCP tool calls, giving you full programmatic access to Feishu/Lark documents.
Key capabilities include:
Create a new cloud document from Lark-flavored Markdown content. Documents are created in the user’s root folder by default, or you can specify a target folder, wiki node, or wiki space. The --folder-token, --wiki-node, and --wiki-space flags are mutually exclusive.
| Parameter | Required | Description |
|---|---|---|
--markdown | Yes | Lark-flavored Markdown content for the document body |
--title | No | Document title (do not repeat as H1 in markdown) |
--folder-token | No | Parent folder token (mutually exclusive with wiki flags) |
--wiki-node | No | Wiki node token to create under |
--wiki-space | No | Wiki space ID; use my_library for personal library |
Returns: doc_id (document token), doc_url (browser link), and message (status). When created under a wiki, the URL may be in /wiki/... format — use doc_id for subsequent API calls.
Scope: docx:document:create
Identity: User or Bot. When using bot identity, grant the user full_access permission after creation.
Retrieve the content of a Lark document by its URL or token. Supports pagination for large documents with --offset and --limit.
| Parameter | Required | Description |
|---|---|---|
--doc | Yes | Document URL or token |
--offset | No | Pagination offset |
--limit | No | Pagination limit (number of blocks to return) |
Scope: docx:document:readonly
Update an existing document using one of 7 update modes. Each mode serves a different editing pattern, from appending content to surgical text replacement. The --selection-with-ellipsis and --selection-by-title locators are mutually exclusive.
| Parameter | Required | Description |
|---|---|---|
--doc | Yes | Document URL or token |
--mode | Yes | append | overwrite | replace_range | replace_all | insert_before | insert_after | delete_range |
--markdown | Yes* | New content in Lark-flavored Markdown (* not required for delete_range) |
--selection-with-ellipsis | Conditional | Content locator using start...end pattern (required for range/replace/insert/delete modes) |
--selection-by-title | Conditional | Title locator, e.g. ## Section Name (alternative to ellipsis selector) |
--new-title | No | Also update the document title |
Scope: docx:document:write_only, docx:document:readonly
Unified search across cloud documents, wiki pages, and spreadsheets using the Search v2 API (POST /open-apis/search/v2/doc_wiki/search). Despite the endpoint name, results include spreadsheets (SHEET type) in addition to docs and wiki pages. Use this as a resource discovery entry point before switching to domain-specific commands.
| Parameter | Required | Description |
|---|---|---|
--query | No | Search keyword (empty = recent documents) |
--filter | No | JSON filter for type/owner/time conditions |
--page-size | No | Results per page (default 15, max 20) |
--page-token | No | Pagination token for next page |
Scope: search:docs:read. Identity: User only (bot identity cannot perform searches).
Insert a local image or file at the end of a document. This command orchestrates a 4-step pipeline with automatic rollback on failure: (1) query document root block, (2) create a placeholder block, (3) upload the file, and (4) bind the uploaded file token to the block. For wiki URLs, a 5th step resolves the wiki node to the actual docx token first.
Maximum file size: 20 MB. Supports PNG, JPG, GIF, WebP, BMP images and general file attachments.
| Parameter | Required | Description |
|---|---|---|
--file | Yes | Local file path (max 20 MB) |
--doc | Yes | Document URL or document_id (docx only) |
--type | No | image (default) or file |
--align | No | left, center, or right |
--caption | No | Image caption text |
Scope: docs:document.media:upload, docx:document:write_only, docx:document:readonly
Download media files or whiteboard thumbnails from documents. The extension is auto-detected from the content type (PNG, JPG, GIF, WebP, SVG, PDF, MP4, TXT).
| Parameter | Required | Description |
|---|---|---|
--token | Yes | Resource token (file_token or whiteboard_id) |
--output | Yes | Local save path |
--type | No | media (default) or whiteboard |
--overwrite | No | Overwrite existing output file (boolean) |
Scope: docs:document.media:download
Whiteboards in Lark documents are created inline using the +create or +update commands with special Markdown syntax. To update whiteboard content, use the whiteboard-cli tool to parse DSL content and pipe it into the update command.
| Parameter | Required | Description |
|---|---|---|
--whiteboard-token | Yes | Whiteboard token (requires edit permission on the parent document) |
--idempotent-token | No | Idempotency token (min 10 characters) |
--overwrite | No | Delete all existing content before updating (default false) |
Supported diagram types include architecture diagrams, flowcharts, org charts, mind maps, and Mermaid/PlantUML diagrams (auto-converted to Lark whiteboard format).
Wiki pages in Feishu use a different URL format (feishu.cn/wiki/XXXXX) than regular documents. When working with wiki content, you need to resolve the wiki token to the actual document token first.
The +media-insert command handles this automatically (5-step orchestration). For other commands, resolve manually:
The +create command supports direct wiki placement via --wiki-node or --wiki-space, so resolution is only needed for read/update operations on existing wiki pages.
| Operation | Scope |
|---|---|
| Create documents | docx:document:create |
| Read documents | docx:document:readonly |
| Update documents | docx:document:write_only, docx:document:readonly |
| Search documents | search:docs:read |
| Upload media | docs:document.media:upload |
| Download media | docs:document.media:download |
| Shortcut | Description | Risk | Identity | Key Parameters |
|---|---|---|---|---|
+create | Create a Lark document from Markdown | Write | User, Bot | --title, --markdown, --folder-token, --wiki-space, --wiki-node |
+fetch | Fetch document content | Read | User, Bot | --doc, --offset, --limit |
+update | Update document (7 modes) | Write | User, Bot | --doc, --mode, --markdown, --selection-with-ellipsis, --selection-by-title, --new-title |
+search | Search docs, wiki, and spreadsheets | Read | User only | --query, --filter, --page-size, --page-token |
+media-insert | Insert local image/file into document | Write | User, Bot | --file, --doc, --type, --align, --caption |
+media-download | Download document media or whiteboard | Read | User, Bot | --token, --output, --type, --overwrite |