REST API Reference

AAditya Kothadiya10 min readAvg. reading speed: 200 words per minuteLast updated Nov 28, 2026

Every endpoint below lives under https://api.webbooks.ai/v1. Send your API key as Authorization: Bearer wb_key_…. Bodies are JSON, and errors look like { "error": { "code", "message" } } (see the Errors chapter). The same operations are MCP tools with the same names, except webhook management.

The machine-readable version is the OpenAPI spec at https://api.webbooks.ai/v1/openapi.json (no key needed).

Account & Credits

Get Account

GET /v1/me

Who you are connected as: the workspace, plan, your permissions, credits left and rate limits. Call this first if unsure what you can do.

Permission

Credits

MCP tool

any key

Free

get_account

No parameters.

curl https://api.webbooks.ai/v1/me \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Get Credits

GET /v1/credits

How many AI credits the workspace has left, and how to add more.

Permission

Credits

MCP tool

any key

Free

get_credits

No parameters.

curl https://api.webbooks.ai/v1/credits \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Buy Credits

POST /v1/credits/checkout

Make a secure checkout link to add AI credits to the workspace (50, 200 or 500). Show the link to the person; credits arrive as soon as they pay.

Permission

Credits

MCP tool

any key

Free

buy_credits

Field

Type

Required

What it is

pack

string

no

How many credits: 50, 200 or 500 (default 200). One of: 50, 200, 500.

curl -X POST https://api.webbooks.ai/v1/credits/checkout \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Books

List Books

GET /v1/books

The workspace's books, most recently changed first.

Permission

Credits

MCP tool

books:read

Free

list_books

Field

Type

Required

What it is

limit

integer

no

How many (default 25).

cursor

string

no

next_cursor from the previous page.

published

boolean

no

Only published (true) or only drafts (false).

curl https://api.webbooks.ai/v1/books \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Create Book

POST /v1/books

Start a new book (a draft until published). Add chapters with create_chapter.

Permission

Credits

MCP tool

books:write

0.5 credits when it sets a description (a written description in WebBooks); titles are free.

create_book

Field

Type

Required

What it is

title

string

yes

The book's title.

description

string

no

What the book is about (shown to readers).

curl -X POST https://api.webbooks.ai/v1/books \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"My title"}'

Get Book

GET /v1/books/{book_id}

One book with its chapter list (titles, ids, word counts, published or not).

Permission

Credits

MCP tool

books:read

Free

get_book

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

curl https://api.webbooks.ai/v1/books/BOOK_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Update Book

PATCH /v1/books/{book_id}

Change a book's title or description. Readers see it after the next publish.

Permission

Credits

MCP tool

books:write

0.5 credits when it sets a description (a written description in WebBooks); titles are free.

update_book

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

title

string

no

description

string

no

curl -X PATCH https://api.webbooks.ai/v1/books/BOOK_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Publishing

Publish Book

POST /v1/books/{book_id}/publish

Publish the book for readers, with its chapters' latest text (all chapters that have text, or the ones you list). Runs check_book first and stops on problems. Confirm with the person before publishing.

Permission

Credits

MCP tool

books:publish

Free

publish_book

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

chapter_ids

list of ids

no

Only publish these chapters (default: every chapter with text).

curl -X POST https://api.webbooks.ai/v1/books/BOOK_ID/publish \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Unpublish Book

POST /v1/books/{book_id}/unpublish

Take a book offline for readers (it stays in the workspace as a draft). Ask the person first.

Permission

Credits

MCP tool

books:publish

Free

unpublish_book

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

curl -X POST https://api.webbooks.ai/v1/books/BOOK_ID/unpublish \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Check Book

GET /v1/books/{book_id}/preflight

The check WebBooks runs before publishing: empty chapters, missing title or description, broken images. Problems block publishing; warnings don't.

Permission

Credits

MCP tool

books:read

Free

check_book

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

chapter_ids

list of ids

no

Only these chapters (default: all with text).

curl https://api.webbooks.ai/v1/books/BOOK_ID/preflight \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Chapters

List Chapters

GET /v1/books/{book_id}/chapters

A book's chapters in reading order, with ids and word counts.

Permission

Credits

MCP tool

books:read

Free

list_chapters

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

curl https://api.webbooks.ai/v1/books/BOOK_ID/chapters \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Create Chapter

POST /v1/books/{book_id}/chapters

Add a chapter to a book, with its text in Markdown. It's a draft until the book is published.

Permission

Credits

MCP tool

books:write

2.5 credits when it has text (writing a chapter in WebBooks); free when empty.

create_chapter

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

title

string

yes

content

string

no

The chapter in Markdown (headings, lists, quotes, links, images by https URL).

position

integer

no

Where to put it (0 = first). Default: at the end.

curl -X POST https://api.webbooks.ai/v1/books/BOOK_ID/chapters \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"My title"}'

Reorder Chapters

PUT /v1/books/{book_id}/chapters/order

Put a book's chapters in a new order: send every chapter id, first to last.

Permission

Credits

MCP tool

books:write

Free

reorder_chapters

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

chapter_ids

list of ids

yes

curl -X PUT https://api.webbooks.ai/v1/books/BOOK_ID/chapters/order \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"chapter_ids":["…"]}'

Read Chapter

GET /v1/chapters/{chapter_id}

A chapter's text as Markdown (or plain text / editor JSON). Long chapters come in parts of 40,000 characters: pass next_offset to read on.

Permission

Credits

MCP tool

books:read

Free

get_chapter

Field

Type

Required

What it is

chapter_id

id (path)

yes

The chapter's id (from list_chapters or get_book).

format

string

no

Default markdown. One of: markdown, text, json.

offset

integer

no

Where to start reading (characters).

curl https://api.webbooks.ai/v1/chapters/CHAPTER_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Update Chapter

PATCH /v1/chapters/{chapter_id}

Rename a chapter and/or change its text. mode "replace" (default) swaps the whole text for the Markdown you send; "append" adds it to the end. Read it first with get_chapter so nothing is lost.

Permission

Credits

MCP tool

books:write

0.3 credits to rewrite or add to a chapter (rewrite/expand in WebBooks); 2.5 when the chapter was empty. Renaming is free.

update_chapter

Field

Type

Required

What it is

chapter_id

id (path)

yes

The chapter's id (from list_chapters or get_book).

title

string

no

content

string

no

Markdown.

mode

string

no

Default replace. One of: replace, append.

curl -X PATCH https://api.webbooks.ai/v1/chapters/CHAPTER_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Delete Chapter

DELETE /v1/chapters/{chapter_id}

Delete a chapter for good. Ask the person first.

Permission

Credits

MCP tool

books:delete

Free

delete_chapter

Field

Type

Required

What it is

chapter_id

id (path)

yes

The chapter's id (from list_chapters or get_book).

curl -X DELETE https://api.webbooks.ai/v1/chapters/CHAPTER_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Book Memory & Search

Get Book Memory

GET /v1/books/{book_id}/memory

What WebBooks remembers about a book: the author's voice, Names & Facts (people, places, terms, rules) and chapter summaries.

Permission

Credits

MCP tool

books:read

Free

get_book_memory

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

curl https://api.webbooks.ai/v1/books/BOOK_ID/memory \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Get Writing Context

GET /v1/books/{book_id}/writing-context

Everything to write in this book's voice, as one text: the author's voice, Names & Facts, chapter summaries, and the end of the chapter you're continuing. Call it before drafting.

Permission

Credits

MCP tool

books:read

Free

get_writing_context

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

chapter_id

id

no

Optional: the chapter you'll write next to or continue.

curl https://api.webbooks.ai/v1/books/BOOK_ID/writing-context \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Search Book

GET /v1/books/{book_id}/search

Find where something appears in a book: chapters, Names & Facts and summaries.

Permission

Credits

MCP tool

books:read

Free

search_book

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

query

string

yes

curl https://api.webbooks.ai/v1/books/BOOK_ID/search \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Analytics & Subscribers

Get Book Analytics

GET /v1/books/{book_id}/analytics

How readers use a book: views, unique readers, reading time and completion, per day, plus subscribers.

Permission

Credits

MCP tool

analytics:read

Free

get_book_analytics

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

days

integer

no

Default 30.

curl https://api.webbooks.ai/v1/books/BOOK_ID/analytics \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

List Subscribers

GET /v1/books/{book_id}/subscribers

People subscribed to a book: counts by status and the most recent sign-ups with their email addresses (personal data: handle with care).

Permission

Credits

MCP tool

subscribers:read

Free

list_subscribers

Field

Type

Required

What it is

book_id

id (path)

yes

The book's id (from list_books).

curl https://api.webbooks.ai/v1/books/BOOK_ID/subscribers \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Webhooks

List Webhooks

GET /v1/webhooks

The workspace's webhook endpoints.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

No parameters.

curl https://api.webbooks.ai/v1/webhooks \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Create Webhook

POST /v1/webhooks

Add an endpoint. The answer includes its signing secret once.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

Field

Type

Required

What it is

url

string

yes

events

list of string

yes

Event names, or ["*"] for all.

description

string

no

book_ids

list of ids

no

curl -X POST https://api.webbooks.ai/v1/webhooks \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/webbooks","events":["…"]}'

Update Webhook

PATCH /v1/webhooks/{webhook_id}

Change an endpoint's URL, events, books or description, or switch it on or off.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

Field

Type

Required

What it is

webhook_id

id (path)

yes

url

string

no

events

list of string

no

description

string

no

book_ids

list of ids

no

enabled

boolean

no

curl -X PATCH https://api.webbooks.ai/v1/webhooks/WEBHOOK_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Delete Webhook

DELETE /v1/webhooks/{webhook_id}

Remove an endpoint and its delivery log.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

Field

Type

Required

What it is

webhook_id

id (path)

yes

curl -X DELETE https://api.webbooks.ai/v1/webhooks/WEBHOOK_ID \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Test Webhook

POST /v1/webhooks/{webhook_id}/test

Send a webhook.test event to the endpoint now.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

Field

Type

Required

What it is

webhook_id

id (path)

yes

curl -X POST https://api.webbooks.ai/v1/webhooks/WEBHOOK_ID/test \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

List Webhook Deliveries

GET /v1/webhooks/{webhook_id}/deliveries

Recent deliveries to an endpoint (last 30 days), newest first.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

Field

Type

Required

What it is

webhook_id

id (path)

yes

status

string

no

One of: pending, sending, retrying, succeeded, failed.

limit

integer

no

curl https://api.webbooks.ai/v1/webhooks/WEBHOOK_ID/deliveries \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY"

Resend Webhook Delivery

POST /v1/webhooks/{webhook_id}/deliveries/{delivery_id}/retry

Send one delivery again now.

Permission

Credits

MCP tool

webhooks:manage

Free

REST only

Field

Type

Required

What it is

webhook_id

id (path)

yes

delivery_id

id (path)

yes

curl -X POST https://api.webbooks.ai/v1/webhooks/WEBHOOK_ID/deliveries/DELIVERY_ID/retry \
  -H "Authorization: Bearer $WEBBOOKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Webhook Events

The list of events is also at https://api.webbooks.ai/v1/events (no key needed). See the Webhooks chapter for payloads and signatures.