# 获取云文档内容

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

## 请求

基本 | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/docs/v1/content
HTTP Method | GET
接口频率限制 | [5 次/秒](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
支持的应用类型 | Custom App、Store App
权限要求<br>**调用该 API 所需的权限。开启其中任意一项权限即可调用** | 查看云文档内容(docs:document.content:read)

### 请求头

名称 | 类型 | 必填 | 描述
---|---|---|---
Authorization | string | 是 | `tenant_access_token`<br>或<br>`user_access_token`<br>**值格式**："Bearer `access_token`"<br>**示例值**："Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[了解更多：如何选择与获取 access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### 查询参数

名称 | 类型 | 必填 | 描述
---|---|---|---
doc_token | string | 是 | 云文档的唯一标识。点击[这里](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-overview)了解如何获取文档的 `doc_token`<br>**示例值**：B4EPdAYx8oi8HRxgPQQbM15UcBf<br>**数据校验规则**：<br>- 长度范围：`22` ～ `27` 字符
doc_type | string | 是 | 云文档类型<br>**示例值**：docx<br>**可选值有**：<br>- docx：新版文档
content_type | string | 是 | 内容类型<br>**示例值**：markdown<br>**可选值有**：<br>- markdown：Markdown 格式
lang | string | 否 | 云文档中存在 @用户 元素时，指定该用户名称的语言。默认 `zh`，即中文<br>**示例值**：zh<br>**可选值有**：<br>- zh：中文<br>- en：英文<br>- ja：日文

## 响应

### 响应体

名称 | 类型 | 描述
---|---|---
code | int | 错误码，非 0 表示失败
msg | string | 错误描述
data | \- | \-
content | string | 内容

### 响应体示例
```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状态码 | 错误码 | 描述 | 排查建议
---|---|---|---
500 | 2889901 | hybrid resource expired | 确认混部资源是否已经过期
403 | 2889902 | no permission | 确认操作者是否有该文档的阅读权限。请参考以下方式为调用身份开通文档权限：<br>- 如果你使用的是 `tenant_access_token`，意味着当前应用没有云文档权限。你需通过云文档网页页面右上方 **「...」** -> **「...更多」** ->**「添加文档应用」** 入口为应用添加权限。<br>![](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/22c027f63c540592d3ca8f41d48bb107_CSas7OYJBR.png?height=1994&maxWidth=550&width=3278)<br>**注意**：在 **添加文档应用** 前，你需确保目标应用至少开通了一个云文档的 [API 权限](https://open.feishu.cn/document/ukTMukTMukTM/uYTM5UjL2ETO14iNxkTN/scope-list)。否则你将无法在文档应用窗口搜索到目标应用。<br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/9f3353931fafeea16a39f0eb887db175_0tjzC9P3zU.png?maxWidth=550)<br>- 如果你使用的是 `user_access_token`，意味着当前用户没有云文档权限。你需通过云文档网页页面右上方 **分享** 入口为当前用户添加权限。<br>![image.png](//sf3-cn.feishucdn.com/obj/open-platform-opendoc/3e052d3bac56f9441296ae22e2969d63_a2DEYrJup8.png?height=278&maxWidth=550&width=1383)<br>了解具体操作步骤或其它添加权限方式，参考[云文档常见问题 3](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#16c6475a)。
400 | 2889904 | invalid param | 确认传入的参数是否合法
500 | 2889905 | internal error | 服务内部错误，请联系[技术支持](https://applink.feishu.cn/TLJpeNdW)
403 | 2889906 | docs deleted | 确认文档是否已被删除
400 | 2889914 | doc token not found | 确认文档 token 是否正确。点击[这里](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/document-docx/docx-overview)了解如何获取文档的 token
500 | 2889925 | content size exceed limit | 文档内容超过 10 MB 限制
500 | 2889980 | operation denied on copying page | 确认文档是否正在创建副本中

