MuseCanto Docs
API

Export knowledge base documents

GET all active documents from an owned knowledge base using a user API key.

Export every active document in a knowledge base you own. The response includes metadata, plain-text bodies, and optionally rendered HTML—suitable for backups, search indexing, and downstream ETL.

For authentication and the Open API prefix, see the developer documentation home. To create documents instead, use Import a document.

Endpoint

GET /api/v1/open/books/{bookSlug}/docs
Authorization: Bearer YOUR_API_KEY
ItemValue
MethodGET
AuthAuthorization: Bearer + full API key
Path parameterbookSlug — knowledge base slug (x_book.slug)
Default scopeActive documents only (status = 1)
OwnershipKey must belong to the knowledge base owner

Query parameters

ParameterDefaultDescription
excludeCategoriestrueWhen true, omits folder nodes (type === "category"). Set to false to include them.
includeContentHtmltrueWhen true, includes contentHtml on each document. Set to false for a lighter payload (contentHtml is still present as null).

Example with categories included and HTML omitted:

GET /api/v1/open/books/my-library/docs?excludeCategories=false&includeContentHtml=false

Example request

Replace YOUR_API_KEY and BOOK_SLUG with your values. Use your deployment origin instead of https://your-domain.com when not running locally.

curl -sS \
  -H "Authorization: Bearer YOUR_API_KEY" \
  "https://your-domain.com/api/v1/open/books/BOOK_SLUG/docs"
$headers = @{ Authorization = "Bearer YOUR_API_KEY" }
Invoke-RestMethod `
  -Uri "https://your-domain.com/api/v1/open/books/BOOK_SLUG/docs" `
  -Headers $headers

Success response

Status: 200 OK

{
  "success": true,
  "book": {
    "id": "…",
    "slug": "BOOK_SLUG",
    "name": "Product notes",
    "description": "Internal team library",
    "coverImage": "https://cdn.example.com/book-cover.png",
    "createdAt": "2026-04-01T08:00:00.000Z",
    "updatedAt": "2026-05-21T10:00:00.000Z"
  },
  "documents": [
    {
      "id": "…",
      "slug": "doc-slug",
      "name": "Requirements",
      "type": "document",
      "parentId": null,
      "orderKey": "a",
      "description": null,
      "emojiInfo": null,
      "cover": { "url": "https://cdn.example.com/doc-cover.png", "position": "center" },
      "tags": ["guide"],
      "themeId": "default",
      "backgroundThemeId": "transparent",
      "bodyFontSize": "default",
      "updatedAt": "2026-05-21T09:00:00.000Z",
      "createdAt": "2026-05-20T08:00:00.000Z",
      "contentStr": "Plain-text body when available",
      "contentHtml": "<p>Rendered HTML body</p>"
    }
  ],
  "meta": { "count": 1 }
}

Response fields

book

FieldTypeDescription
idstringKnowledge base ID
slugstringKnowledge base slug
namestringDisplay name
descriptionstring | nullShort description
coverImagestring | nullCover image URL
createdAtstring (ISO 8601)Created at
updatedAtstring (ISO 8601)Last updated at

documents[]

FieldTypeDescription
idstringDocument ID
slugstringDocument slug
namestringTitle
typestringdocument, category, etc.
parentIdstring | nullParent node ID (tree)
orderKeystringSibling sort key
descriptionstring | nullSummary
emojiInfostring | nullIcon metadata
coverobject | nullCover header image: { url, position } (url is proxy-resolved; position is the CSS object-position, center when unset)
tagsstring[] | nullTags
themeIdstringEditor typography theme (default when unset)
backgroundThemeIdstringEditor background theme (transparent when unset)
bodyFontSizestringBody font preset: default, 14, or 12
createdAtstring (ISO 8601)Created at
updatedAtstring (ISO 8601)Last updated at
contentStrstring | nullPlain-text body
contentHtmlstring | nullRendered HTML body (null when includeContentHtml=false). Relative image and attachment URLs are rewritten with the same CDN proxy prefix used in the editor (config.storage.proxyUrls.cmsFile), so exported <img src="..."> values are directly fetchable.

Notes:

  • contentStr and contentHtml are included by default. Large libraries may produce heavy responses; use includeContentHtml=false when you only need plain text.
  • contentYjs and contentJson (editor-internal formats) are not returned.
  • Documents are ordered by orderKey within the knowledge base.

Error responses

All errors use a flat envelope:

{ "success": false, "code": "<MACHINE_CODE>", "message": "<human readable>" }
HTTPcodeWhen
401INVALID_API_KEYMissing header, invalid, expired, or revoked key
404BOOK_NOT_FOUNDUnknown slug, or library not owned by the key user
429RATE_LIMITEDAPI key verification rate limit exceeded
500EXPORT_FAILEDUnexpected server error (cause is logged server-side, not echoed)

Example:

{
  "success": false,
  "code": "BOOK_NOT_FOUND",
  "message": "Knowledge base not found"
}

404 vs 403

Non-owned slugs return 404 instead of 403 to avoid leaking whether a slug exists.

Limitations (current version)

  • Read-only: does not update or delete documents.
  • No pagination; all matching documents are returned in one response.
  • No per-key knowledge base allowlist (any owned slug works).
  • Does not access public or password-protected libraries you do not own.

See also