SuperAPI AI Directory

feishu-wiki

General & other

View repository

Updated 10-15 19:54

About this skill

Feishu Wiki

Manage knowledge spaces and page nodes via the Wiki v2 API.

Base URL: https://open.feishu.cn/open-apis/wiki/v2

Authentication and Token Retrieval

From the feishu_skills root directory, run the shared script:

TOKEN="$(./scripts/get_feishu_token.sh)"

Request headers uniformly use Authorization: Bearer ${TOKEN}。

If a business API returns an invalid token, expired token, or 401, force a refresh and retry the original request only once:

TOKEN="$(./scripts/get_feishu_token.sh --force-refresh)"

Environment Variables:

  • FEISHU_APP_ID
  • FEISHU_APP_SECRET

Local Cache: ./.feishu_token_cache.json(reused directly if not expired; refreshes 5 minutes early by default)


Knowledge Spaces

API Endpoint Description
Create Space POST /spaces {"name":"知识库名称"}
Get List GET /spaces -
Get Details GET /spaces/{space_id} -

⚠️ Permission Penetration: After a space is created, the bot has no permission to maintain it by default. Recommended:

  1. Create a group containing the bot
  2. In the knowledge base [Settings], add this group as an "admin"
  3. The bot gains operation rights through the group identity

Page Nodes

API Endpoint Description
Create Node POST /spaces/{space_id}/nodes Create Wiki Page
Get Node GET /spaces/{space_id}/nodes/{node_token} -
Move Node POST /spaces/{space_id}/nodes/{node_token}/move -

Create Node:

{
  "obj_type": "docx",
  "parent_node_token": "root",
  "node_type": "origin",
  "origin_node_token": "doxcnXXX",
  "title": "页面标题"
}

obj_type: doc / sheet / mindnote / bitable / file / docx


Best Practices

  1. Group Authorization Method(solves permission issues)
  2. Create the document first, then associate it(origin_node_token)
  3. Suitable for knowledge accumulation scenarios