OpenClaw 代理操作指南:通过 API 创建、读取和编辑飞书/Lark 文档。适用场景:(1) 新建飞书文档并写入内容;(2) 读取已有文档内容。
OperationAPI EndpointCreate docPOST /drive/v1/documentsGet doc metadataGET /drive/v1/documents/{id}Get doc blocksGET /drive/v1/documents/{id}/blocksAdd blocksPOST /drive/v1/documents/{id}/blocks/{parent_id}/childrenSet public permPATCH /drive/v1/permissions/{id}/public?type=docx
bash
curl -X POST "https://open.feishu.cn/open-apis/drive/v1/documents" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"title": "文档标题"}'
bash
curl -X POST "https://open.feishu.cn/open-apis/drive/v1/documents/{doc_id}/blocks/{block_id}/children" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"children": [{"block_type": 2, "text": {"elements": [{"text_run": {"content": "内容"}}]}}]}'
Block types: 2 =text, 3 =h1, 4 =h2, 7 =bullet (⚠️ may error, use text instead)
bash
curl -X PATCH "https://open.feishu.cn/open-apis/drive/v1/permissions/{doc_id}/public?type=docx" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"link_share_entity": "anyone_editable",
"external_access_entity": "anyone_can_edit",
"security_entity": "anyone_can_edit",
"comment_entity": "anyone_can_edit",
"share_entity": "anyone"
}'
web_fetch tool on https://feishu.cn/docx/{doc_id}/drive/v1/documents/{id} then /blockstools.sessions.visibility: "all" in openclaw.jsonblock_type: 7 (bullet), use plain text blocks instead"tools": {"sessions": {"visibility": "all"}} to openclaw.jsonFor detailed API specs, permissions guide, and example workflows, see references/guide.md.