Open API Docs
Create Document
Admin
2026/4/3
8 阅读
Create Document
Endpoint
POST /api/open/documents
Request body
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Document title |
slug | string | No | URL slug |
content | string | No | Markdown content |
excerpt | string | No | Document summary |
order | number | No | Sort order |
published | boolean | No | Publish state |
parentId | string | No | Parent document ID |
categoryId | string | Yes for top-level docs | Category ID |
authorId | string | Yes | Author user ID |
Behavior rules
- Top-level documents must provide
categoryId. - Child documents inherit the top-level category automatically.
- If
slugis omitted, the server generates one from the title.
Recommended validation
- Make sure the author exists before calling the API.
- Use a stable slug strategy in production.
- Keep
ordersmall for documents that should appear earlier.
