### Make Document Public Response Example
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Example of the response after making a document public. It confirms the change and provides the public read URL for the document.
```text
→ ✓ acme/api-overview is now public · https://htmlbook.io/d/a1b2c3
```
--------------------------------
### Publish Document Request Example
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Example of a plain language request to an agent to summarize an API and publish it to htmlbook. The agent will then call the publish function.
```text
Summarize this folder's API as a one-page HTML doc and publish it to htmlbook
under project "acme".
```
--------------------------------
### Publish Document Response Example
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Example of the response received after successfully publishing a document to htmlbook. It includes a link to the shelved document and indicates it's private by default.
```text
✓ shelved (hbdoc) · acme/api-overview · v1 · read: https://htmlbook.io/app/p/acme/api-overview
private — set_access "public" for a share link
```
--------------------------------
### Make Document Public Request Example
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Example of a plain language request to make a previously published document public. This action generates a shareable link.
```text
Make that doc public.
```
--------------------------------
### guide
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Returns the authoring contract, including hb-doc classes, tokens, components, allowed tags, and the token-cheap file push. Call this once before composing hb-doc HTML manually.
```APIDOC
## guide
### Description
Return the authoring contract (hb-doc classes, tokens, components, allowed tags, the token-cheap file push). Call it once before composing hb-doc HTML by hand.
### Parameters
No parameters.
### Request Example
```json
{ "tool": "guide" }
```
```
--------------------------------
### Report Notes Example
Source: https://github.com/streamize-llc/htmlbook/blob/main/examples/report.md
Provides a simple text note related to cohort analysis, demonstrating a basic text block.
```text
Cohort analysis lives in the analytics workspace.
This file demonstrates GFM tables, task lists, and alert callouts.
```
--------------------------------
### API Response Structure
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Example of a successful API response when publishing a document. Includes project, slug, version, kind, owner reader link, and public share link (if applicable).
```json
{
"project": "acme",
"slug": "q3-report",
"version": 1,
"kind": "hbdoc",
"url": "https://htmlbook.io/app/p/acme/q3-report",
"shareUrl": "https://htmlbook.io/d/a1b2c3"
}
```
--------------------------------
### Publish Markdown Document via Agent
Source: https://github.com/streamize-llc/htmlbook/blob/main/README.md
Example of an agent publishing a Markdown document to htmlbook. The document content is provided directly in the JSON payload.
```json
{
"tool": "publish",
"project": "acme",
"markdown": "# Q3 Review\n\nRevenue is up 8% QoQ...\n\n## Highlights\n- ..."
}
```
--------------------------------
### get
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Fetches a document's metadata and current body, useful for read-then-republish workflows. The `meta_only` option can be used for cheaper existence and version checks.
```APIDOC
## get
### Description
Fetch a document's metadata + current body (read-then-republish workflows). Set `meta_only` to skip the body for cheap existence/version checks.
### Parameters
#### Request Body
- **tool** (string) - Required - Must be "get"
- **project** (string) - Required
- **slug** (string) - Required
- **meta_only** (boolean?) - Optional - omit the HTML body
### Request Example
```json
{ "tool": "get", "project": "acme", "slug": "q3", "meta_only": true }
```
```
--------------------------------
### Get Authoring Contract
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Retrieve the authoring contract, which includes hb-doc classes, tokens, and allowed tags. Call this once before manually composing hb-doc HTML.
```json
{ "tool": "guide" }
```
--------------------------------
### Get Document Metadata
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Fetch a document's metadata and current body. Use 'meta_only' to skip the body for cheaper existence or version checks.
```json
{ "tool": "get", "project": "acme", "slug": "q3", "meta_only": true }
```
--------------------------------
### SVG Chart with Themed Colors
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/hb-doc-contract.md
An example of an inline SVG chart styled using CSS variables (--hb-accent) to ensure it correctly adopts the theme provided by the reader.
```html
Revenue, last six months
```
--------------------------------
### Configure htmlbook MCP Server in Project
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Share htmlbook connection details with a repository by creating a project-scoped .mcp.json file. This allows agents within the project to connect to htmlbook using the specified API key.
```json
{
"mcpServers": {
"htmlbook": {
"type": "http",
"url": "https://htmlbook.io/api/mcp",
"headers": { "Authorization": "Bearer ${HTMLBOOK_API_KEY}" }
}
}
}
```
--------------------------------
### Configure htmlbook MCP Server for Cursor
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Set up the htmlbook MCP server configuration for the Cursor editor. This can be done globally in ~/.cursor/mcp.json or per-project in .cursor/mcp.json.
```json
{
"mcpServers": {
"htmlbook": {
"url": "https://htmlbook.io/api/mcp",
"headers": { "Authorization": "Bearer hb_live_REPLACE_WITH_YOUR_KEY" }
}
}
}
```
--------------------------------
### Set HTMLBOOK_API_KEY and Publish Script
Source: https://github.com/streamize-llc/htmlbook/blob/main/examples/README.md
Sets the API key environment variable and executes the publish script. Ensure your API key is valid.
```bash
export HTMLBOOK_API_KEY="hb_live_xxxxxxxxxxxx"
./publish.sh
```
--------------------------------
### Publish Full Custom HTML Page via REST API
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/publishing.md
Use this command to publish a full custom HTML page (bundle) via the REST API. The content is sent as binary data.
```bash
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=pricing-calculator" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @calculator.html
```
--------------------------------
### Organize Document
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Update a document's title, tags, or path, move it to another project, or rename it.
```json
{ "tool": "organize", "project": "acme", "slug": "q3",
"tags": ["report", "finance"], "title": "Q3 Review" }
```
--------------------------------
### Configure htmlbook MCP Server for Codex CLI
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Configure the htmlbook MCP server for the Codex CLI using a TOML configuration file. This method uses an environment variable for the API key.
```toml
[mcp_servers.htmlbook]
url = "https://htmlbook.io/api/mcp"
bearer_token_env_var = "HTMLBOOK_API_KEY"
```
--------------------------------
### Restore Previous Document Version
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/sharing.md
The `restore` tool allows owners to revert a document to an earlier immutable version, specifying the project, slug, and the desired version number.
```json
{ "tool": "restore", "project": "acme", "slug": "q3", "version": 3 }
```
--------------------------------
### publish
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Shelves a document to a hosted, shareable URL. Creates a new immutable version if the project/slug already exists. Use this when you want to share content or access it from another device.
```APIDOC
## publish
### Description
Shelve a document to a hosted, shareable URL — a new immutable version when `project`/`slug` already exist. Reach for it whenever you've produced something the user will want to read on another device or share, instead of leaving it as a local file.
### Parameters
#### Request Body
- **tool** (string) - Required - Must be "publish"
- **project** (string) - Required - groups the document
- **slug** (string?) - Optional - derived from the title when omitted
- **markdown** (string?) - Optional - GFM source — kept as the source of truth
- **html** (string?) - Optional - an `` fragment, or any full page (→ bundle)
**Note:** Pass exactly one of `markdown` or `html`.
### Request Example
```json
{ "tool": "publish", "project": "acme", "slug": "q3", "markdown": "# Q3\n\nUp 8%." }
```
### Response
- **shelved** (hbdoc) - Indicates the document was shelved.
- **project/slug** (string) - The project and slug of the shelved document.
- **version** (string) - The version identifier.
- **url** (string) - The public read URL when public.
```
--------------------------------
### Connect Claude Code Agent with API Key
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Connect your Claude Code agent to htmlbook using an API key stored in an environment variable. Ensure the HTMLBOOK_API_KEY is set before running this command.
```bash
claude mcp add --transport http htmlbook https://htmlbook.io/api/mcp \
--header "Authorization: Bearer $HTMLBOOK_API_KEY"
```
--------------------------------
### Add htmlbook MCP Server (Claude Code - No Key)
Source: https://github.com/streamize-llc/htmlbook/blob/main/README.md
Connect Claude Code to the htmlbook MCP endpoint without needing an API key by approving the login in your browser.
```bash
claude mcp add --transport http htmlbook https://htmlbook.io/api/mcp
# then run `claude` and approve the htmlbook login
```
--------------------------------
### Publish Large Document via REST API
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/publishing.md
For large documents, push the file directly using the REST API with '--data-binary'. This avoids bloating agent context.
```bash
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=q3-dashboard" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @dashboard.html
```
--------------------------------
### List Documents
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Browse your library of documents, with an option to filter by project.
```json
{ "tool": "list", "project": "acme" }
```
--------------------------------
### Read Source Markdown via API
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Retrieve the raw Markdown source of a document using its project and slug. Requires authentication. Add '&download=1' to the query string to download the source as an attachment.
```bash
# Owner — Markdown source (add &download=1 for an attachment)
curl -s "https://htmlbook.io/api/docs/source?project=acme&slug=q3-report" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY"
```
--------------------------------
### Push a file
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Upload a document as the raw request body. The `project` and `slug` are provided as query parameters. HTMLBook automatically detects the content type (Markdown or HTML).
```APIDOC
## POST /api/docs
### Description
Upload a document as the raw request body. HTMLBook automatically detects the content type (Markdown or HTML) based on the `Content-Type` header or by sniffing the leading characters of the content.
### Method
POST
### Endpoint
https://htmlbook.io/api/docs
### Parameters
#### Query Parameters
- **project** (string) - Required - The project identifier.
- **slug** (string) - Optional - A unique identifier for the document within the project. If omitted, it's derived from the title or first heading.
### Request Example
```bash
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=q3-report" \
-H "Authorization: Bearer " \
--data-binary @q3-report.md
```
### Response
#### Success Response (200)
- **project** (string) - The project identifier.
- **slug** (string) - The slug of the document.
- **version** (integer) - The version number of the document.
- **kind** (string) - The type of content (e.g., "hbdoc").
- **url** (string) - The owner reader link for the document.
- **shareUrl** (string) - The public share link for the document (present only if the document is public).
#### Response Example
```json
{
"project": "acme",
"slug": "q3-report",
"version": 1,
"kind": "hbdoc",
"url": "https://htmlbook.io/app/p/acme/q3-report",
"shareUrl": "https://htmlbook.io/d/a1b2c3"
}
```
```
--------------------------------
### Set Document Access to Public
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/sharing.md
Use the `set_access` tool with the desired project, slug, and 'public' visibility to make a document publicly accessible and retrieve its share link.
```json
{ "tool": "set_access", "project": "acme", "slug": "q3", "visibility": "public" }
```
--------------------------------
### Push Markdown File via cURL
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Recommended method to push a Markdown document. The document is sent as the raw request body, with 'project' and 'slug' specified in the query string. Content-Type can be inferred or explicitly set.
```bash
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=q3-report" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @q3-report.md
```
--------------------------------
### GitHub-Style Alerts as Callouts
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/markdown.md
Shows how GitHub-style alerts are rendered as styled callouts in the htmlbook reader view.
```markdown
> [!NOTE]
> Neutral aside.
> [!TIP]
> A green tip box.
> [!WARNING]
> An ochre warning box.
```
--------------------------------
### Read the source back (Owner)
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Retrieve the raw source of a document for a specific project and slug. An optional `download=1` query parameter can be added to download the source as an attachment.
```APIDOC
## GET /api/docs/source
### Description
Retrieve the raw source of a document for a specific project and slug. Requires authentication. An optional `download=1` query parameter can be added to download the source as an attachment.
### Method
GET
### Endpoint
https://htmlbook.io/api/docs/source
### Parameters
#### Query Parameters
- **project** (string) - Required - The project identifier.
- **slug** (string) - Required - The slug of the document.
- **download** (boolean) - Optional - If set to `1`, the source will be downloaded as an attachment.
### Request Example
```bash
curl -s "https://htmlbook.io/api/docs/source?project=acme&slug=q3-report" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY"
```
### Response
#### Success Response (200)
The raw source content of the document (Markdown or HTML).
```
--------------------------------
### Publish dashboard.html using curl
Source: https://github.com/streamize-llc/htmlbook/blob/main/examples/README.md
Publishes an HTML file named 'dashboard.html' to htmlbook. This requires specifying the project and slug in the query parameters. Ensure your HTMLBOOK_API_KEY is set.
```bash
# dashboard.html needs project/slug in the query
curl -s -X POST "https://htmlbook.io/api/docs?project=examples&slug=q3-dashboard" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @dashboard.html
```
--------------------------------
### Read Public Document Source
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Retrieve the raw source of a public document using its share URL. No authentication is required for public documents.
```bash
# Public document — raw source, no auth
curl -s "https://htmlbook.io/d/a1b2c3/raw"
```
--------------------------------
### General MCP Client Configuration for htmlbook
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Provides general connection details for any MCP client to connect to htmlbook. It specifies the endpoint, transport, and authentication method.
```text
Endpoint: https://htmlbook.io/api/mcp
Transport: streamable-http
Auth: Authorization: Bearer (CLI / config clients)
or OAuth 2.1 with Dynamic Client Registration (claude.ai / Desktop)
```
--------------------------------
### Report Task List
Source: https://github.com/streamize-llc/htmlbook/blob/main/examples/report.md
Outlines the features shipped for the Q3 report, including completed and pending items.
```markdown
- [x] New onboarding flow
- [x] Workspace invites
- [ ] Billing migration (slips to Q4)
```
--------------------------------
### Set HTMLBOOK API Key Environment Variable
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Store your htmlbook API key in an environment variable for secure access. This key is essential for connecting your agent to the htmlbook service.
```bash
export HTMLBOOK_API_KEY="hb_live_xxxxxxxxxxxxxxxxxxxx"
```
--------------------------------
### Rendered Markdown Elements
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/markdown.md
Demonstrates standard GitHub-Flavored Markdown elements including headings, paragraphs with formatting, links, tables, task lists, and fenced code blocks.
```markdown
# Title
A paragraph with **bold**, _italic_, `code`, and [links](https://htmlbook.io).
## A table
| Metric | Value | Δ |
|--------|------:|--:|
| MRR | $12.4k| +8% |
## A task list
- [x] Ship onboarding
- [ ] Migrate billing
## A fenced code block
```python
print("rendered with syntax styling")
```
```
--------------------------------
### Connect Claude Code Agent via HTTP (Browser Login)
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Connect your Claude Code agent to htmlbook using HTTP without needing to manage an API key directly. This method involves an in-browser approval step.
```bash
claude mcp add --transport http htmlbook https://htmlbook.io/api/mcp
# then run `claude` and approve the htmlbook login in your browser
```
--------------------------------
### Publish Document
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Shelve a document to a hosted, shareable URL. Use this when you need to make content available for reading on other devices or for sharing. Pass exactly one of 'markdown' or 'html'.
```json
{ "tool": "publish", "project": "acme", "slug": "q3", "markdown": "# Q3\n\nUp 8%." }
```
--------------------------------
### organize
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Allows modification of a document's title, tags, and path. It also supports moving documents to different projects or renaming them.
```APIDOC
## organize
### Description
Set title/tags/path, move to another project, or rename.
### Parameters
#### Request Body
- **tool** (string) - Required - Must be "organize"
- **project** (string) - Required
- **slug** (string) - Required
- **title** (string?) - Optional
- **tags** (string[]?) - Optional
- **path** (string?) - Optional
- **move_to_project** (string?) - Optional
- **rename_slug** (string?) - Optional
### Request Example
```json
{ "tool": "organize", "project": "acme", "slug": "q3",
"tags": ["report", "finance"], "title": "Q3 Review" }
```
```
--------------------------------
### Add htmlbook Custom Connector URL
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Add htmlbook as a custom connector for clients like claude.ai and Claude Desktop. This requires using OAuth and approving the connection via your browser.
```text
Connector URL: https://htmlbook.io/api/mcp
```
--------------------------------
### Push Content via JSON Body
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Alternative method to push content using a JSON request body. The body can contain either 'html' or 'markdown' fields. 'project' and 'slug' are still required in the query string. This method requires setting the 'Content-Type' header to 'application/json'.
```bash
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=q3" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "markdown": "# Q3\n\nRevenue up 8% QoQ." }'
```
--------------------------------
### Set Document Access to Public
Source: https://github.com/streamize-llc/htmlbook/blob/main/README.md
Command to make a published htmlbook document publicly accessible. This provides a shareable link for anyone.
```text
Agent: htmlbook → set_access (visibility: public)
✓ acme/q3-dashboard is now public · https://htmlbook.io/d/a1b2c3
```
--------------------------------
### Publish Markdown Document via MCP Tool
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/publishing.md
Use this snippet to publish a Markdown document. The content is provided directly in the 'markdown' field.
```json
{
"tool": "publish",
"project": "acme",
"slug": "q3-review",
"markdown": "# Q3 Review\n\nRevenue up 8% QoQ.\n\n## Highlights\n- New onboarding\n- Churn down to 2.1%"
}
```
--------------------------------
### Sync Folder with Curl
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/markdown.md
A bash script using curl to sync a folder of Markdown files to htmlbook. It iterates through all .md files and posts them to the API.
```bash
for f in docs/**/*.md; do
curl -s -X POST "https://htmlbook.io/api/docs" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @"$f"
done
```
--------------------------------
### Publish report.md using curl
Source: https://github.com/streamize-llc/htmlbook/blob/main/examples/README.md
Publishes a Markdown file named 'report.md' to htmlbook. This file self-addresses via frontmatter, meaning project, slug, and visibility are defined within the file itself. Requires a valid HTMLBOOK_API_KEY.
```bash
# report.md self-addresses via frontmatter (project/slug/visibility live in the file)
curl -s -X POST "https://htmlbook.io/api/docs" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @report.md
```
--------------------------------
### Markdown with Self-Addressing Frontmatter
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/markdown.md
Illustrates a Markdown file with leading YAML frontmatter for self-addressing, including project, slug, title, tags, summary, and visibility.
```markdown
---
project: acme
slug: q3-report
title: Q3 Report
tags: [report, finance]
summary: Revenue, churn, and the onboarding rollout
visibility: public
---
# Q3 Report
...
```
--------------------------------
### Publish hb-doc HTML Fragment via MCP Tool
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/publishing.md
Publish an HTML fragment with the 'hb-doc' class using this snippet. The content is provided in the 'html' field.
```json
{
"tool": "publish",
"project": "acme",
"slug": "q3-dashboard",
"html": "
Q3 Dashboard
MRR
$12.4k
+8%
"
}
```
--------------------------------
### Push HTML File via cURL
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Push an HTML document. HTML files are automatically detected and processed. If the HTML contains '', it's treated as an hb-doc; otherwise, it's a bundle. 'project' and 'slug' are query parameters.
```bash
# HTML — becomes an hb-doc if it has , else a bundle
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=dashboard" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
--data-binary @dashboard.html
```
--------------------------------
### restore
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Rolls a document back to a previous snapshot version. This action is restricted to the owner.
```APIDOC
## restore
### Description
Roll a document back to an earlier snapshot version (owner-only).
### Parameters
#### Request Body
- **tool** (string) - Required - Must be "restore"
- **project** (string) - Required
- **slug** (string) - Required
- **version** (number) - Required - Must be ≥ 1
### Request Example
```json
{ "tool": "restore", "project": "acme", "slug": "q3", "version": 3 }
```
```
--------------------------------
### Delete Document (Soft Delete)
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/sharing.md
Use the `delete` tool to perform a soft delete on a document, moving it to the trash for potential restoration or permanent purging.
```json
{ "tool": "delete", "project": "acme", "slug": "q3" }
```
--------------------------------
### Verify Claude MCP Agent Connection
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/getting-started.md
Check the connection status of your Claude MCP agent to the htmlbook server. This command lists all connected MCP servers and their status.
```bash
claude mcp list
# htmlbook ✓ connected
```
--------------------------------
### list
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Browses your library of documents, with an option to filter by project.
```APIDOC
## list
### Description
Browse your library, optionally filtered by project.
### Parameters
#### Query Parameters
- **project** (string?) - Optional - filter to one project
- **limit** (number?) - Optional - 1–500
### Request Example
```json
{ "tool": "list", "project": "acme" }
```
### Response
Returns each doc's `project`, `slug`, `title`, `tags`, `visibility`, `version`, `updatedAt`, `shortId`, and a public `url` when public.
```
--------------------------------
### Read the source back (Public)
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Retrieve the raw source of a public document using its share URL. This endpoint does not require authentication.
```APIDOC
## GET /d/{shareId}/raw
### Description
Retrieve the raw source of a public document using its share ID. This endpoint does not require authentication.
### Method
GET
### Endpoint
https://htmlbook.io/d/{shareId}/raw
### Parameters
#### Path Parameters
- **shareId** (string) - Required - The unique share ID of the public document.
### Request Example
```bash
curl -s "https://htmlbook.io/d/a1b2c3/raw"
```
### Response
#### Success Response (200)
The raw source content of the public document (Markdown or HTML).
```
--------------------------------
### Report Data Table
Source: https://github.com/streamize-llc/htmlbook/blob/main/examples/report.md
Displays key Q3 report metrics including MRR, Churn, and Active workspaces, comparing Q2 and Q3 values.
```markdown
| Metric | Q2 | Q3 | Change |
|--------|---:|---:|------:|
| MRR | $11.5k | $12.4k | +8% |
| Churn | 3.4% | 2.1% | −1.3pt |
| Active workspaces | 420 | 511 | +21% |
```
--------------------------------
### Publish Response for Private Document
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/sharing.md
The publish response indicates a document is private and suggests using `set_access` to make it public and obtain a share link.
```text
shelved (hbdoc) · acme/q3 · v1 · read: https://htmlbook.io/app/p/acme/q3
private — set_access "public" for a share link
```
--------------------------------
### Minimal hb-doc Structure
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/hb-doc-contract.md
This is the basic structure of an hb-doc, including the main article and content divs, a title, a lede paragraph, a section heading, and a KPI card component.
```html
Q3 Review
One-paragraph intro that sets up the page.
Numbers
MRR
$12.4k
+8%
A green callout for a takeaway.
```
--------------------------------
### Publish Document
Source: https://github.com/streamize-llc/htmlbook/blob/main/README.md
Publish an AI-generated document (Markdown, hb-doc HTML, or a bundle) to htmlbook. The document will be stored, versioned, and made available via a shareable link. The format is auto-detected.
```APIDOC
## POST /api/docs
### Description
Publishes a document to htmlbook. The document can be in Markdown, hb-doc HTML, or a bundle format. htmlbook auto-detects the format and makes it available via a shareable link.
### Method
POST
### Endpoint
https://htmlbook.io/api/docs
### Parameters
#### Request Body
- **markdown** (string) - Optional - The document content in Markdown format.
- **html** (string) - Optional - The document content in hb-doc HTML format.
- **bundle** (string) - Optional - A self-contained HTML page with its own CSS/JS.
- **project** (string) - Required - The project identifier for the document.
- **visibility** (string) - Optional - The visibility of the document ('public' or 'private'). Defaults to 'private'.
### Request Example
```json
{
"tool": "publish",
"project": "acme",
"markdown": "# Q3 Review\n\nRevenue is up 8% QoQ..."
}
```
### Response
#### Success Response (200)
- **id** (string) - The unique identifier for the published document.
- **project** (string) - The project identifier.
- **version** (string) - The version of the document.
- **share_url** (string) - The shareable URL for the document.
#### Response Example
```json
{
"id": "acme/q3-dashboard",
"project": "acme",
"version": "v1",
"share_url": "https://htmlbook.io/app/p/acme/q3-dashboard"
}
```
```
--------------------------------
### delete
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Moves a document to the trash. This is a soft delete and the document can be restored from the web Trash.
```APIDOC
## delete
### Description
Move a document to the trash (soft delete; restorable from the web Trash).
### Parameters
#### Request Body
- **tool** (string) - Required - Must be "delete"
- **project** (string) - Required
- **slug** (string) - Required
### Request Example
```json
{ "tool": "delete", "project": "acme", "slug": "q3" }
```
```
--------------------------------
### REST API Endpoint and Authentication
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
The base endpoint for the REST API and the required Authorization header format. The API key is the same as used for MCP and is bound to a single workspace.
```text
POST https://htmlbook.io/api/docs
Authorization: Bearer
```
--------------------------------
### HTMLBook Metadata Block
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/hb-doc-contract.md
A script block with type application/json and id htmlbook-meta placed before the article content. It contains metadata like title, tags, and summary for indexing.
```html
```
--------------------------------
### Push JSON body
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/rest-api.md
Alternatively, send the document content within a JSON body. The content can be provided as either `html` or `markdown` fields. `project` and `slug` are still provided as query parameters.
```APIDOC
## POST /api/docs (JSON Body)
### Description
Send the document content within a JSON body. The content can be provided as either `html` or `markdown` fields. `project` and `slug` are still provided as query parameters.
### Method
POST
### Endpoint
https://htmlbook.io/api/docs
### Parameters
#### Query Parameters
- **project** (string) - Required - The project identifier.
- **slug** (string) - Optional - A unique identifier for the document within the project. If omitted, it's derived from the title or first heading.
#### Request Body
- **html** (string) - Optional - The HTML content of the document.
- **markdown** (string) - Optional - The Markdown content of the document.
### Request Example
```bash
curl -s -X POST "https://htmlbook.io/api/docs?project=acme&slug=q3" \
-H "Authorization: Bearer $HTMLBOOK_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "markdown": "# Q3\n\nRevenue up 8% QoQ." }'
```
### Response
#### Success Response (200)
- **project** (string) - The project identifier.
- **slug** (string) - The slug of the document.
- **version** (integer) - The version number of the document.
- **kind** (string) - The type of content (e.g., "hbdoc").
- **url** (string) - The owner reader link for the document.
- **shareUrl** (string) - The public share link for the document (present only if the document is public).
#### Response Example
```json
{
"project": "acme",
"slug": "q3-report",
"version": 1,
"kind": "hbdoc",
"url": "https://htmlbook.io/app/p/acme/q3-report",
"shareUrl": "https://htmlbook.io/d/a1b2c3"
}
```
```
--------------------------------
### set_access
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/mcp-tools.md
Changes the access level of a document to either public or private.
```APIDOC
## set_access
### Description
Make a document public or private.
### Parameters
#### Request Body
- **tool** (string) - Required - Must be "set_access"
- **project** (string) - Required
- **slug** (string) - Required
- **visibility** (string) - Required - Accepts `"public"` or `"private"`
### Request Example
```json
{ "tool": "set_access", "project": "acme", "slug": "q3", "visibility": "public" }
```
### Response
- **message** (string) - Confirmation message, e.g., `acme/q3 is now public`.
- **url** (string) - The public URL when visibility is set to `"public"`.
```
--------------------------------
### Public Document Notification
Source: https://github.com/streamize-llc/htmlbook/blob/main/docs/sharing.md
This message confirms that a document has been made public and provides its public shareable URL.
```text
acme/q3 is now public · https://htmlbook.io/d/a1b2c3
```
--------------------------------
### Set Document Access
Source: https://github.com/streamize-llc/htmlbook/blob/main/README.md
Changes the access level of a published document, making it either public or private. This operation is typically invoked by an agent to control who can view the document.
```APIDOC
## POST /api/docs/{id}/access
### Description
Sets the access level for a specific document. This allows you to make a document public or revert it to private.
### Method
POST
### Endpoint
https://htmlbook.io/api/docs/{id}/access
### Parameters
#### Path Parameters
- **id** (string) - Required - The identifier of the document (e.g., 'project/document-name').
#### Request Body
- **visibility** (string) - Required - The desired visibility level ('public' or 'private').
### Request Example
```json
{
"visibility": "public"
}
```
### Response
#### Success Response (200)
- **message** (string) - A confirmation message indicating the change in visibility.
- **url** (string) - The shareable URL for the document (updated if visibility changed to public).
#### Response Example
```json
{
"message": "acme/q3-dashboard is now public",
"url": "https://htmlbook.io/d/a1b2c3"
}
```
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.