You will need php (~7.1+) installed on the machine you want to run this script on. You will also need BookStack API credentials (TOKEN_ID & TOKEN_SECRET) at the ready.
This has quickly been thrown together and is not an officially supported part of BookStack.
# Downloading the script
curl https://gist.githubusercontent.com/ssddanbrown/45acb913a7b873240b2d89781e74a7a4/raw/export-books.php > export-books.php
# Setup
# ALTERNATIVELY: Open the script and edit the variables at the top.
export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
export BS_TOKEN_ID=abc123 # Set to be your API token_id
export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
# Running the script
php export-books.php <format> <output_dir>
# Examples
## Export as plaintext to an existing "out" directory
php export-books.php plaintext ./out
## Export as pdf to the current directory
php export-books.php pdf ./
## Export as HTML to an existing "html" directory
php export-books.php html ./html
@folletst You can find API access details when editing your profile in BookStack, you'll need "Access system API" permissions.
Since I've created this I've been pooling any API scripts into a central repo, that's more likely to be updated.
Therefore you may be better following this version here:
https://github.com/BookStackApp/api-scripts/tree/main/php-export-all-books