Publishing
POST/v1/books/{bookId}/publishscope: publish:write
Publish or unpublish a book. On publish, every chapter must have content; Anthra mints a globally unique slug (reusing the book’s slug if it was already published before), sets publishedAt, and revalidates the public reader at /read/{slug}.
Body
| Field | Type | Notes |
|---|---|---|
publish | boolean | Required. true publishes (status → published); false reverts to ready. |
visibility | private | unlisted | public | Optional. Defaults to whatever the book already has. unlisted = anyone with the slug can read; public = also indexable. |
curl -X POST "$ANTHRA_BASE/books/$BOOK/publish" \
-H "authorization: Bearer $ANTHRA_TOKEN" \
-H "content-type: application/json" \
-d '{ "publish": true, "visibility": "unlisted" }'The response includes the updated Book, including slug and readerUrl.
Common errors
400 invalid_state— “Finish writing all chapters before publishing.” Some chapter has emptycontent.403 insufficient_scope— the token doesn’t carrypublish:write.