Create a document

Create a page from Markdown, optionally under a folder path.

{
    "title": "Create a document",
    "description": "",
    "method": "POST",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/spaces/{space}/documents",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer YOUR_API_TOKEN",
            "type": "string",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "type": "string",
            "required": true
        },
        {
            "key": "Content-Type",
            "value": "application/json",
            "type": "string",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Numeric Space ID.",
            "type": "integer",
            "required": true
        }
    ],
    "bodyType": "json",
    "requestBody": "{\n  \"title\": \"Payment lifecycle\",\n  \"content\": \"# Payment lifecycle\\n\\nPayments move from pending to settled.\",\n  \"path\": \"guides/payments\"\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "201": {
            "description": "HTTP 201: success: true, message, data.id, name, type, parent_id, url, created_at; public Spaces add public_url. Save the returned ID for future reads and updates. Illustrative JSON example; sample values are fictional. Some optional or additional resource fields may be omitted.",
            "body": "{\n  \"success\": true,\n  \"data\": {\n    \"id\": 456,\n    \"name\": \"Payment lifecycle\",\n    \"parent_id\": null\n  },\n  \"message\": \"Document created successfully\"\n}"
        },
        "401": {
            "description": "Missing or invalid account API token.Missing or invalid account API token. Example JSON response.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        }
    }
}

Request fields

Field Requirement
title Required title: string, maximum 255 characters.
content Required content: Markdown string.
parent_id Optional parent_id: integer ID of a folder in the same Space.
path Optional path: string up to 500 characters, such as guides/payments.
path A non-empty path creates/reuses its folder hierarchy and takes precedence over parent_id.

Usage notes

  • Requires Space management access.
  • 422 for invalid input or a parent that is not a folder in this Space; 403 without permission.
  • The request sends Markdown, not a TipTap JSON object.
  • Search indexing follows asynchronously; use Read a document to verify the saved body immediately.

API authentication.

Updated