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_IDFEISHU_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:
- Create a group containing the bot
- In the knowledge base [Settings], add this group as an "admin"
- 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
- Group Authorization Method(solves permission issues)
- Create the document first, then associate it(
origin_node_token) - Suitable for knowledge accumulation scenarios