Spaces API – PUT /api/spaces/{space}/documents/{spaceMenuItem}

This endpoint updates an existing document (menu item) within a Space. It supports partial updates, allowing you to change one or more fields without resending the entire resource.

🔒 Authentication

All Spaces API routes require a valid Bearer token in the Authorization header. The authenticated user must have management rights on the target Space.

Authorization: Bearer <your_token>
Content-Type: application/json

Endpoint

{
    "title": "Update Space Document",
    "description": "Partially or fully update a document (menu item) in a Space",
    "method": "PUT",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/spaces/{space}/documents/{spaceMenuItem}",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer <token>",
            "required": true
        },
        {
            "key": "Content-Type",
            "value": "application/json",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "space",
            "value": "Space UUID or ID",
            "required": true
        },
        {
            "key": "spaceMenuItem",
            "value": "Document ID",
            "required": true
        }
    ],
    "bodyType": "json",
    "requestBody": "{\n  \"title\": \"New Doc Title\",\n  \"content\": \"# Hello World\",\n  \"type\": \"markdown\",\n  \"parent_id\": 42\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Document updated successfully",
            "body": "{\n  \"success\": true,\n  \"data\": {\n    \"id\": 101,\n    \"name\": \"New Doc Title\",\n    \"type\": \"markdown\",\n    \"parent_id\": 42,\n    \"url\": \"https://app.docuwriter.ai/spaces/1/menu-items/101\",\n    \"updated_at\": \"2025-09-17T12:34:56Z\"\n  },\n  \"message\": \"Document updated successfully\"\n}"
        },
        "403": {
            "description": "Access denied (missing rights)",
            "body": "{ \"success\": false, \"message\": \"Access denied. You do not have permission to update documents in this space.\" }"
        },
        "404": {
            "description": "Space or document not found / mismatch",
            "body": "{ \"success\": false, \"message\": \"Document does not belong to this space.\" }"
        },
        "422": {
            "description": "Validation failed",
            "body": "{ \"success\": false, \"message\": \"Validation failed\", \"errors\": { \"content\": [\"The content field is required.\"] } }"
        },
        "500": {
            "description": "Server error",
            "body": "{ \"success\": false, \"message\": \"Failed to update document: Unexpected error.\" }"
        }
    }
}

✏️ Request Parameters

Path Parameters

Name Type Description
space string ID or UUID of the Space
spaceMenuItem int ID of the document to update

JSON Body Fields

Field Type Required Description
title string no New document title (max 255 chars).
content string no Document body. If type=markdown, this is raw Markdown; otherwise stored as-is.
type enum no blank (default) or markdown. Determines content storage format.
parent_id integer no ID of a Folder within the same Space to move this document under.