Skip to content

获取云文档内容 ​

可获取云文档内容,当前只支持获取新版文档 Markdown 格式的内容。

请求 ​

项目值
HTTP URLhttps://open.feishu.cn/open-apis/docs/v1/content
HTTP MethodGET
接口频率限制5 次/秒
支持的应用类型custom,isv
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用docs:document.content:read 查看云文档内容

请求头 ​

名称类型必填描述
Authorizationstring是tenant_access_token 或 user_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token

查询参数 ​

名称类型必填描述
doc_tokenstring是云文档的唯一标识。点击这里了解如何获取文档的 doc_token
示例值:B4EPdAYx8oi8HRxgPQQbM15UcBf
数据校验规则:
- 长度范围:22 ~ 27 字符
doc_typestring是云文档类型
示例值:docx
可选值有:
- docx: 新版文档
content_typestring是内容类型
示例值:markdown
可选值有:
- markdown: Markdown 格式
langstring否云文档中存在 @用户 元素时,指定该用户名称的语言。默认 zh,即中文
示例值:zh
可选值有:
- zh: 中文 - en: 英文 - ja: 日文

响应 ​

响应体 ​

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--
  └ contentstring内容

响应体示例 ​

json
{
    "code": 0,
    "msg": "success",
    "data": {
        "content": "# Markdown Export Example Document\n\n# Text\n\n**Bold**\n\n*Italic*\n\n~~Strikethrough~~\n\nHyperlink: [Feishu Open Platform](https%3A%2F%2Fopen.feishu.cn)\n\nInline code: `inline code`\n\nUnderline\n\nBackground color + font color\n\nPlain text with markdown syntax needs to be escaped, such as \\*\\*bold syntax\\*\\*, \\*italic syntax\\*, ~~strikethrough syntax~~, \\[hyperlink syntax\\]\\(https://open\\.feishu\\.cn\\), \\`inline code syntax\\`, etc.\n\nMentionDoc: [Markdown Export Example Document](https://example.feishu.cn/docx/FlYadoUfloTbYcxoJcccEoabcef)\n\nMentionUser: @Zhang San\n\nDate reminder: ⏰2024-04-27 15:30\n\nButton: Follow document updates open hyperlink - google\n\nInline file: \\[Markdown Export Example Document.md\\]\n\n# Bullet\n\n- **Bold**\n\n    - *Italic*\n\n    - ~~Strikethrough~~\n\n- Hyperlink: [Feishu Open Platform](https%3A%2F%2Fopen.feishu.cn)\n\n    - Inline code: `inline code`\n\n- Underline\n\n    - Background color + font color\n\n# Ordered\n\n1. **Bold**\n\n    1. *Italic*\n\n    2. ~~Strikethrough~~\n\n2. Hyperlink: [Feishu Open Platform](https%3A%2F%2Fopen.feishu.cn)\n\n    1. Inline code: `inline code`\n\n        1. Underline\n\n        2. Background color + font color\n\n# Code\n\n```JavaScript\nfunction greeting() {\n    console.log(\"Hello, World!\");\n}\n```\n\n# Quote\n\n> **Bold**\n> \n> *Italic*\n> \n> ~~Strikethrough~~\n> \n> Hyperlink: [Feishu Open Platform](https%3A%2F%2Fopen.feishu.cn)\n> \n> Inline code: `inline code`\n> \n> Underline\n> \n> Background color + font color\n> \n\n# Task\n\n* [ ] ~~This is an incomplete task list [Markdown Export Example Document](https://example.feishu.cn/docx/FlYadoUfloTbYcxoJcccEoabcef)⏰2024-04-27 15:30~~\n\n* [x] ~~This is a completed task list~~\n\n# Divider (Horizontal Rule)\n\n---\n\n# Table\n\n\n\n\n\n**Location**\n\n\n\n\n**Features**\n\n\n\n\n**Cuisine**\n\n\n\n\n**Price**\n\n\n\n\n\n\nShenzhen Old Street Snacks\n\n\n\n\nTraditional Cuisine\n\n\n\n\n- Roast Meat\n\n    - Roast Duck\n\n    - Roast Goose\n\n    - Roast Pork\n\n- Dim Sum\n\n    - Rice Noodle Roll\n\n    - Glutinous Rice Chicken\n\n- Seafood\n\n    - Shark Fin\n\n    - Seafood Congee\n\n\n\n\nMedium\n\n\n\n\n\n\nDameisha Seafood Street\n\n\n\n\nSeafood Market\n\n\n\n\n- Fresh Seafood\n\n    - Lobster\n\n    - Crab\n\n    - Scallops\n\n\n\n\nMedium-High\n\n\n\n\n\n\nNanshan District Seafood Street\n\n\n\n\nSeafood Market\n\n\n\n\n- Crab Roe Bun\n\n    - Crab Roe Soup Dumpling\n\n    - Crab Roe Steamed Bun\n\n- Stir-Fried Snail Rice Noodle\n\n    - Stir-Fried Snail Rice Noodle\n\n    - Stir-Fried Rice Noodle\n\n\n\n\nMedium\n\n\n\n\n\n\nLianhua Mountain Restaurant\n\n\n\n\nMountain Cuisine\n\n\n\n\n- Wild Game\n\n    - Wild Boar Meat\n\n    - Goat Meat\n\n    - Venison\n\n- Farmer's Dish\n\n    - Farmer's Stir-Fry\n\n    - Farmer's Claypot Rice\n\n\n\n\nMedium-High\n\n\n\n\n\n\nShenzhen Huaqiangbei Food Street\n\n\n\n\nFood Street\n\n\n\n\n- Hot Pot\n\n    - Spicy Hot Pot\n\n    - Clear Soup Hot Pot\n\n- Skewered Snacks\n\n    - Spicy Skewered Snacks\n\n    - Sour and Spicy Skewered Snacks\n\n- Barbecue\n\n    - Grilled Fish\n\n    - Grilled Meat\n\n\n\n\nLow to Medium\n\n\n\n\n\n# Grid\n\n\n\n\n**Image One**\n\n\n\n\n**Image Two**\n\n\n\n\n**Image Three**\n\n\n\n\n# Callout\n\n\n\nPlain text with markdown syntax needs to be escaped, such as \\*\\*bold syntax\\*\\*, \\*italic syntax\\*, ~~strikethrough syntax~~, \\[hyperlink syntax\\]\\(https://open\\.feishu\\.cn\\), \\`inline code syntax\\`, etc.\n\n\n\n# SyncedSource\n\n**Bold**\n\n*Italic*\n\n~~Strikethrough~~\n\nHyperlink: [Feishu Open Platform](https%3A%2F%2Fopen.feishu.cn)\n\nInline code: `inline code`\n\nUnderline\n\n# SyncedReference\n\n# File\n\n\\[Markdown Export Example Document.md\\]\n\n# Bookmark\n\n[https://open.feishu.cn/]()\n\n# Poll\n\n# Agenda\n\nThis is the content of the agenda\n\n# Sheet\n\n# Bitable\n\n# Chart\n\n# Group Name Card\n\n# Whiteboard\n\n# Widget"
    }
}

错误码 ​

HTTP状态码错误码描述排查建议
5002889901hybrid resource expired确认混部资源是否已经过期
4032889902no permission确认操作者是否有该文档的阅读权限。请参考以下方式为调用身份开通文档权限: - 如果你使用的是 tenant_access_token,意味着当前应用没有云文档权限。你需通过云文档网页页面右上方 「...」 -> 「...更多」 ->「添加文档应用」 入口为应用添加权限。 注意:在 添加文档应用 前,你需确保目标应用至少开通了一个云文档的 API 权限。否则你将无法在文档应用窗口搜索到目标应用。 image.png - 如果你使用的是 user_access_token,意味着当前用户没有云文档权限。你需通过云文档网页页面右上方 分享 入口为当前用户添加权限。 image.png 了解具体操作步骤或其它添加权限方式,参考云文档常见问题 3。
4002889904invalid param确认传入的参数是否合法
5002889905internal error服务内部错误,请联系技术支持
4032889906docs deleted确认文档是否已被删除
4002889914doc token not found确认文档 token 是否正确。点击这里了解如何获取文档的 token
5002889925content size exceed limit文档内容超过 10 MB 限制
5002889980operation denied on copying page确认文档是否正在创建副本中

内容来源:飞书开放平台 · 自动爬取整理