MrDoc User Guide
Basic concepts
MrDoc page description
2.1 Home page
2.2 Collection browsing page
2.3 Document browsing page
2.4 Document editing and modification
2.4.1 Creating a document
2.4.2 Modify document
2.4.3 Create document template
2.4.4 Modify document template
2.4.5 Brief introduction to Markdown syntax
2.4.7 Uploading attachments
2.4.8 Draw a mind map
2.5, Personal Center
2.5.1 Managing documents
2.5.2 Managing collections
2.5.3 Managing document templates
2.5.4 Managing images
2.5.5 Managing user tokens
2.7 Registration and login
2.7.1 User registration
2.7.2 User login
Getting started
Create collection
Create document
Add member collaboration
Documents and knowledge base basics
Collection basic configuration
Pin collection
WebHook message push
Hide collection on homepage
Collection association set
Collection tab configuration
Document editing and content creation
Add document attachments
Show document directory
Create document shortcut
Set document tags
Set document alias
Insert video
Automatic document saving
Document management and organization
Collection directory sorting
Modify document sorting
Subordinate document control
Set document parent-child
Document version history
Transfer collection
Transfer document
Copy document/Move document
Document access records
Collection export and download
Document download and export
Export document PDF
Document drag-and-drop sorting
Collaboration and permission management
Set document permissions
Set collection access permissions
Document copy protection
Set document watermark
Collection collaboration/Collection member management
Document sharing
Collection sharing
Enable document comments
Image and attachment management
Configure image/attachment upload size limit
Configure image upload formats
Configure attachment upload formats/attachment allowlist
Attachment preview
Transfer attachments/Transfer images
Clean up images
Extract attachment text in bulk with the manage command
Data import and migration
Desktop client import
Import Joplin notebooks
Import Evernote
Web import
Command-line import
Web export
Third-party login configuration
DingTalk QR code login and in-app passwordless login configuration
WeCom authentication integration
LDAP authentication integration configuration
OIDC authentication integration
WeChat Official Account web authorization
Third-party storage configuration
MinIO configuration
Qiniu Cloud OSS configuration
Alibaba Cloud OSS configuration
AWS S3 configuration
AI knowledge base and intelligent Q&A
Basic configuration
AI model configuration
Qdrant deployment
Dify framework configuration
Rebuild document AI index
AI features
AI document creation
AI knowledge base Q&A
AI Q&A bot
WeCom smart robot
OnlyOffice integration
Drawio integration
System settings and management
Site information configuration
Homepage template configuration
Official website theme homepage configuration instructions
User and account configuration
Statistics code configuration
Document ads/info blocks/custom head configuration
Disable update detection
Site-wide search mode
Display image thumbnails in documents
Site feedback
RSS subscription
Site single tag settings
Outbound email configuration
Site data export
Editor configuration
Collection documentation page displays site top navigation bar.
Site announcement configuration
Personal account management
Set default editor
Set user nickname
Modify user password
Bind a third-party account
API and developer interfaces
Get user token
Get collection list
Get collection directory
Get collection document list
Get personal document list
Get specified document content
Create new collection
Create a new document
Update documentation
Upload image
Upload attachments
Verify user token
Upload local Office/PDF files as documents
Client and ecosystem integration
Desktop client
Mobile client
Browser extensions
Obsidian plugins
Common usage issues index
Powered by MrDoc Pro
-
+
home
Upload local Office/PDF files as documents
# Upload a Local Office/PDF File as a Document ## URL `/api/upload_office_doc/?token={token}` ## Request Method `POST` ## Parameters ### Query Parameters | Parameter Name | Data Type | Required | Description | | ----- | ------ | ---- | -------------------- | | token | string | Yes | User Token, used for identity verification and permission validation | ### Body Parameters (form-data) | Parameter Name | Data Type | Required | Description | | ---------- | ------- | ---- | ------------------------------------------------------------ | | pid | integer | Yes | Project ID, the Office document will be created in the specified project | | parent_doc | integer | No | Parent document ID, defaults to `0`, meaning it is created as a top-level document | | file | file | Yes | The uploaded Office file, supporting Word, Excel, PowerPoint, and other Office formats supported by MrDoc | ## Response Result | Field Name | Data Type | Description | | ------ | --------------- | ------------------------------- | | status | boolean | Whether the request succeeded, `true` means success, `false` means failure | | data | object / string | Returns document information on success, error message on failure | ### Response Examples **Success response:** ```json { "status": true, "data": { "doc_id": 123, "filename": "2026/07/项目需求文档.docx" } } ``` Returned field descriptions: | Field Name | Data Type | Description | | -------- | ------- | --------------------------- | | doc_id | integer | The document ID after successful creation | | filename | string | The relative path of the Office file in the MrDoc storage directory | **Failure response:** Invalid Token: ```json { "status": false, "data": "token无效" } ``` User has no permission: ```json { "status": false, "data": "用户无权限操作" } ``` Parameter error: ```json { "status": false, "data": "参数错误" } ``` No project permission: ```json { "status": false, "data": "无文集权限" } ``` No file selected: ```json { "status": false, "data": "未选择文件" } ``` File size exceeds limit: ```json { "status": false, "data": "文件大小超出限制" } ``` File format not supported: ```json { "status": false, "data": "文件格式不支持" } ``` System exception: ```json { "status": false, "data": "系统异常" } ``` --- ## Permission Description * The user must have Writer permission. * The user must have the permission to add documents (`writer_value[1] == '1'`). * The user must have the add permission for the target project, otherwise the API will return **"无文集权限"**. --- ## Python Example ```python # coding: utf-8 import requests # MrDoc address base_url = 'http://192.168.1.2' # User Token token = '56968edc671b65265d20ab12631c7d5737edd0dab373e4e8e54a28f9' url = f'{base_url}/api/upload_office_doc/?token={token}' # Project ID to upload to pid = 1 # Parent document ID (0 means top-level document) parent_doc = 0 # Local Office file office_file = '/path/to/项目需求文档.docx' with open(office_file, 'rb') as f: files = { 'file': f } data = { 'pid': pid, 'parent_doc': parent_doc } resp = requests.post(url, data=data, files=files) print(resp.json()) ``` --- ## Error Code Description | Error Message | Description | | -------- | ----------------------------- | | token无效 | The provided Token does not exist or has expired | | 用户无权限操作 | The current user does not have permission to create documents | | 参数错误 | The request is missing required parameters (such as `pid`) | | 无文集权限 | The current user does not have the add permission for the target project | | 未选择文件 | No Office file was uploaded in the request | | 文件大小超出限制 | The uploaded file exceeds the maximum size allowed by the system or the file is empty | | 文件格式不支持 | The uploaded file is not an Office document format supported by MrDoc | | 系统异常 | An exception occurred while the server was processing the request |
mrdoc
Sept. 29, 2026, 6:44 p.m.
Forward
Favorites
Last
Next
Scan the QR Code
Copy link
Scan the QR code to share.
Copy link
share
link
type
password
Update password
Validity period
Markdown file
Word document
PDF document (print)