canonical: https://jentic.com/apis/bookstackapp.com/bookstack

# Bookstackapp BookStack API

Jentic maintains a validated, agent-ready OpenAPI specification for BookStack API. BookStack is a self-hosted documentation and knowledge platform that organises content into shelves, books, chapters, and pages. The API exposes 59 endpoints covering books, chapters, pages, shelves, users, roles, attachments, the image gallery, search, the recycle bin, the audit log, and content permissions. Use it to push docs into BookStack programmatically, export pages as PDF or markdown, manage user access, and audit changes - all against a self-hosted instance.

## For AI agents

Create and update books, chapters, and pages, export them as PDF or markdown, manage users and permissions, and search a self-hosted BookStack instance.

## Scope

Does not handle wiki rendering for end users, real-time collaborative editing, or external chat - use for BookStack content management, export, and permissions only.

## Capabilities

- Create books, chapters, and pages and update their content programmatically
- Export any book, chapter, or page as HTML, PDF, plain text, or markdown
- Search across all BookStack content with a single query endpoint
- Manage users and roles to control who can read or edit each piece of content
- Upload attachments and images and reference them from page content
- List the audit log to see who changed what, and restore items from the recycle bin

## Use cases

### CI-Driven Documentation Publishing

Publish documentation from a CI pipeline by creating or updating pages in BookStack whenever the source markdown changes. POST `/api/pages` and PUT `/api/pages/{id}` accept HTML or markdown content, and GET `/api/pages/{id}/export/markdown` lets you check in the rendered version. Removes the manual copy-paste step that doc-as-code teams otherwise live with.

Example prompt: PUT `/api/pages/4521` with the markdown rendered from docs/install.md in the latest commit

### Documentation Export and Archive

Export an entire book or chapter to PDF or markdown for offline distribution, customer downloads, or archival snapshots. GET `/api/books/{id}/export/pdf` and `/export/markdown` return the rendered file. Useful for support teams that need to ship a versioned documentation package alongside a software release.

Example prompt: GET `/api/books/87/export/pdf` and upload the response to s3://docs-archive/v24.0.0.pdf

### Knowledge Base Search for Internal Tools

Surface BookStack search inside an internal tool or chat assistant so employees can find the right page without switching apps. GET `/api/search` runs a query across all readable content and returns matching books, chapters, and pages. Pairs well with content permissions so users only see what they can read.

Example prompt: GET `/api/search`?query='oauth setup' and return the top three results with their URLs

### User Lifecycle and Permissions

Provision and deprovision BookStack users from an HRIS or SSO source so the right people have the right access at all times. POST `/api/users` creates the account, PUT `/api/users/{id}` updates roles, and DELETE `/api/users/{id}` removes them. PUT `/api/content-permissions/{contentType}/{contentId}` restricts sensitive books to specific roles.

Example prompt: POST `/api/users` with name 'Ana', email 'ana@example.com', and role_id 5 for the Editors role

### AI Agent Documentation Assistant

An AI agent uses Jentic to discover BookStack operations, drafts new pages from natural-language prompts, exports books as PDF for customers, and answers questions by searching the live knowledge base. The BookStack token pair lives in your Jentic One instance so the agent never sees the raw secret. Replaces a multi-day API integration with a single search-load-execute cycle per action.

Example prompt: Search Jentic for 'create a BookStack page', load the operation, and execute it under chapter 87 with the drafted content

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/api/pages` | Create a page |
| PUT | `/api/pages/{id}` | Update a page |
| GET | `/api/pages/{id}/export/pdf` | Export a page as PDF |
| GET | `/api/search` | Search across all content |
| POST | `/api/users` | Create a user |
| PUT | `/api/content-permissions/{contentType}/{contentId}` | Update content permissions |
| GET | `/api/audit-log` | List audit log entries |
| PUT | `/api/recycle-bin/{deletionId}` | Restore a deleted item |

## Key resources

- **Books** — Top-level documentation containers; create, update, list, delete, and export
- **Chapters** — Group pages within a book; full CRUD plus export to multiple formats
- **Pages** — Atomic content units; create, update, list, delete, and export to PDF, HTML, plain text, or markdown
- **Shelves** — Group books into shelves for top-level navigation
- **Users and Roles** — Manage accounts and their permission sets
- **Attachments and Image Gallery** — Upload and manage files and images referenced by pages
- **Search** — Run a single query across all readable content
- **Recycle Bin and Audit Log** — Restore deleted items and inspect change history
- **Content Permissions** — Set who can read or edit a specific piece of content

## Why Jentic

- **Setup:** Wiring BookStack by hand means handling its token auth, where the Authorization header carries a Token ID and secret pair, pointing at your own self-hosted host, and managing paging across the content endpoints yourself. Through Jentic you install once, import the BookStack API from the API Directory, store the token pair once, and your agent calls it.
- **Permission scoping:** BookStack puts the resource id in the URL path (`/api/pages/{id}`, `/api/content-permissions/{contentType}/{contentId}`), so a rule can pin your agent to a specific page or book. You choose the operations it may call, so writes like updating a page or emptying the recycle bin are not included unless you add them, and a read-only agent can be limited to search and PDF export.
- **Credential handling:** Your BookStack token ID and secret pair is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create a BookStack page' or 'export a book as PDF', and Jentic returns the matching BookStack operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Bonusly API** — Recognise contributors who write BookStack documentation via Bonusly bonuses.
- **BoldSign API** — Sign-off on a BookStack policy page can be tracked through BoldSign signatures.
- **Boast API** — Boast collects external testimonials while BookStack manages internal documentation.

## FAQ

### Where does the BookStack OpenAPI spec on this page come from?

BookStack is self-hosted, so every instance serves its own API reference: an HTML page at `/api/docs` and a JSON view of the same data at `/api/docs.json`, which BookStack's own reference describes as 'Show a JSON view of the API docs data.' That JSON is BookStack's internal documentation data structure, not an OpenAPI document, and on the public demo instance it is token-gated, returning HTTP 401 without an API token. Jentic generates and maintains this OpenAPI specification from BookStack's published reference so AI agents and developers can call BookStack API via structured tooling. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the BookStack API use?

BookStack uses a token ID and token secret pair, sent in the Authorization header in the form 'Token {tokenId}:{tokenSecret}'. Through Jentic the pair is stored encrypted in the vault and only a scoped, short-lived form reaches the agent context.

### Can I export a BookStack book or page as PDF?

Yes. GET `/api/books/{id}/export/pdf` returns the full book as PDF, and the same suffix works for `/api/chapters/{id}/export/pdf` and `/api/pages/{id}/export/pdf.` Markdown, HTML, and plain text variants are also available.

### How do I search BookStack content through Jentic?

Search Jentic for 'search BookStack content', load the GET `/api/search` operation, then execute it with your query string. The response returns matching books, chapters, and pages with their URLs.

### What are the rate limits for the BookStack API?

BookStack rate limits depend on your self-hosted instance configuration - there is no shared cloud limit. If your instance is behind a reverse proxy, configure throttling there and back off on HTTP 429 responses.

### Can I restore a page that was deleted by accident?

Yes. List recycle bin items with GET `/api/recycle-bin`, find the deletionId, and restore the item with PUT `/api/recycle-bin/{deletionId}.` DELETE on the same path permanently removes it.

### Can I limit what my agent is allowed to do with the BookStack API?

Yes. Because you run Jentic One yourself, your own rules decide which BookStack operations and credentials the agent can use, so you can grant only search and PDF export and leave out writes like updating a page or emptying the recycle bin. Since BookStack puts the resource id in the URL path, such as `/api/pages/{id}` and `/api/content-permissions/{contentType}/{contentId}`, a rule can pin the agent to a specific page or book. Any operation you do not add stays off limits, and the stored token pair is injected only at execution time and never reaches the agent's context.
