Spaces API β GET /api/spaces/{space}/documents/{spaceMenuItem}
This endpoint retrieves a specific document within a Space.
π Authentication
Access to this endpoint requires a valid token. Include the token in the Authorization header:
Authorization: Bearer <your_sanctum_token>
π Path Parameters
Use URL path parameters to specify the target Space and Document:
| Parameter | Type | Description |
|---|---|---|
| space | integer | ID of the Space to query |
| spaceMenuItem | integer | ID of the Document (menu item) within the Space |
πΎ Responses
200 OK
Returns the documentβs metadata and content.
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true |
data.id |
integer | Document ID |
data.name |
string | Document name/title |
data.content |
string | Rendered Markdown (converted from blocks if applicable) |
data.raw_content |
string|array | Original content (Editor.js JSON or Markdown) |
data.type |
string | blank or other SpaceMenuItemType value |
data.parent_id |
integer|null | Parent folder ID (if nested) |
data.space_id |
integer | ID of the containing Space |
data.iscontentconvertedtoblock |
boolean | Whether content was stored as blocks |
Example 200 Response
{
"success": true,
"data": {
"id": 42,
"name": "Project Overview",
"content": "# Project Overview\nThis is an overview...",
"raw_content": "## raw Editor.js JSON or markdown string",
"type": "blank",
"parent_id": null,
"space_id": 1,
"is_content_converted_to_block": false
}
}
403 Forbidden
Returned when the authenticated user lacks permission to view the Space.
{
"success": false,
"message": "Access denied. You do not have permission to view documents in this space."
}
404 Not Found
Occurs if the specified document does not belong to the given Space.
{
"success": false,
"message": "Document does not belong to this space."
}
500 Internal Server Error
Captured if an unexpected exception occurs during processing.
{
"success": false,
"message": "Failed to fetch document: <error details>"
}
βοΈ Interactive API Block
{
"title": "Get Space Document",
"description": "Retrieve a specific document from a space, returning both rendered Markdown and raw content.",
"method": "GET",
"baseUrl": "https://app.docuwriter.ai",
"endpoint": "/api/spaces/{space}/documents/{spaceMenuItem}",
"headers": [
{
"key": "Authorization",
"value": "Bearer <token>",
"required": true
}
],
"queryParams": [],
"pathParams": [
{
"key": "space",
"value": "Space ID",
"required": true
},
{
"key": "spaceMenuItem",
"value": "Document ID within the Space",
"required": true
}
],
"bodyType": "none",
"requestBody": "",
"formData": [],
"rawBody": "",
"responses": {
"200": {
"description": "Success",
"body": "{\n \"success\": true,\n \"data\": {\n \"id\": 42,\n \"name\": \"Project Overview\",\n \"content\": \"# Project Overview\\nThis is an overview...\",\n \"raw_content\": \"## raw Editor.js JSON or markdown string\",\n \"type\": \"blank\",\n \"parent_id\": null,\n \"space_id\": 1,\n \"is_content_converted_to_block\": false\n }\n}"
},
"403": {
"description": "Forbidden",
"body": "{\n \"success\": false,\n \"message\": \"Access denied. You do not have permission to view documents in this space.\"\n}"
},
"404": {
"description": "Not Found",
"body": "{\n \"success\": false,\n \"message\": \"Document does not belong to this space.\"\n}"
},
"500": {
"description": "Internal Server Error",
"body": "{\n \"success\": false,\n \"message\": \"Failed to fetch document: <error details>\"\n}"
}
}
}
Updated