Spaces API – GET /api/spaces

Retrieve the list of Spaces accessible to the authenticated user. Spaces serve as self-contained workspaces for organizing and sharing documentation in DocuWriter.ai.

Authentication πŸ”‘

All requests to this endpoint require a valid Bearer token. Include the token in the Authorization header as a Bearer token.

Endpoint

  • Method: GET
  • URL: /api/spaces
  • Description: Returns all Spaces owned by (or accessible to) the current user, sorted by creation date (newest first).

Listing Behavior

  • Retrieves the authenticated user’s Spaces via the spaces() relation (ordered by created_at descending).
  • No pagination parameters (page, per_page) are supported.
  • No filtering by name, visibility, or other attributes is available.

Response Fields πŸ“¦

Each Space object contains the following properties:

Field Type Description
id integer Unique identifier of the Space.
name string Name of the Space.
is_public boolean Visibility flag (true = public, false = private).
created_at string ISO-8601 timestamp when the Space was created.
items_count integer Number of documents/items currently in the Space.

Errors & Status Codes

Status Code Condition Response Body
200 Successful retrieval { "success": true, "data": [ / Space objects / ] }
401 Missing or invalid authentication { "message": "Unauthenticated." }
403 Authenticated but access forbidden { "message": "Forbidden." }

API Reference

{
    "title": "List Spaces",
    "description": "Retrieve all Spaces the authenticated user can access.",
    "method": "GET",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/spaces",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer <token>",
            "required": true
        },
        {
            "key": "Accept",
            "value": "application/json",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Success",
            "body": "{\n  \"success\": true,\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"Project Docs\",\n      \"is_public\": false,\n      \"created_at\": \"2025-09-10T14:23:45Z\",\n      \"items_count\": 42\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Public API Specs\",\n      \"is_public\": true,\n      \"created_at\": \"2025-08-20T09:12:30Z\",\n      \"items_count\": 15\n    }\n  ]\n}"
        },
        "401": {
            "description": "Unauthorized",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        },
        "403": {
            "description": "Forbidden",
            "body": "{\n  \"message\": \"Forbidden.\"\n}"
        }
    }
}