v1.0.0 REST API OpenAPI 3.1

Headless API Documentation

Build custom author workflows, integrate book distribution with your personal website, automate newsletter subscribers, and fetch real-time analytics with the BookBeam Headless API.

Overview & Base URL

All API endpoints are scoped under the /api/v1 prefix. Requests must include Accept: application/json and send JSON payloads with Content-Type: application/json unless uploading multipart files.

API Base URL https://bookbeam.app/api/v1
Default Headers Accept: application/json
Authorization: Bearer {token}

Team Context: If your user account belongs to multiple teams, specify X-Team-ID: {team_id} to switch active team scope for any authenticated request.

BookBeam CLI

The official jonbaldie/bookbeam-cli orchestrates the headless API from your terminal. Manage book projects, upload files, create signup links, export subscribers, and query analytics in shell scripts. It sends authenticated requests to the same /api/v1 endpoints documented here.

1. Install

With Go installed, install the CLI from its public repository:

go install github.com/jonbaldie/bookbeam-cli@latest

Go installs the binary as bookbeam-cli in your Go bin directory. Rename it to bookbeam (or bookbeam.exe on Windows) and add that directory to your PATH to use the commands below.

2. Sign in

Start browser login, approve the displayed device code in BookBeam, then check your identity. The CLI saves the resulting token for subsequent commands.

bookbeam auth login
bookbeam whoami

3. Work with your books

Create a project, then replace 123 with its ID from the project list. Use the path to your own EPUB, MOBI, or PDF when uploading.

bookbeam projects create --title "My Book" --json
bookbeam projects list --json
bookbeam files upload 123 ./book.epub --json
bookbeam files list 123 --json
bookbeam links create 123 --title "Reader sample" --consent "Join my newsletter" --json
bookbeam links list 123 --json
bookbeam downloaders export 123 --output ./subscribers.csv

These commands call the project, file, signup link, and downloader endpoints below. The export command writes a CSV file to your chosen path.

4. Automate API requests

For scripts or CI, supply an existing personal access token through BOOKBEAM_TOKEN. Use your CI secret store for the value. The following shell examples use --json to return API responses for tools such as jq.

export BOOKBEAM_TOKEN="your-api-token"
bookbeam projects list --json
bookbeam metrics --json
bookbeam billing status --json

# Target a local BookBeam server with a token issued by that server
bookbeam --host http://localhost:8000 projects list --json

The default host is https://bookbeam.app. Override it with --host or BOOKBEAM_HOST, using the origin without /api/v1. Run bookbeam --help or bookbeam projects --help for more commands and flags.

Authentication & Tokens

BookBeam uses Laravel Sanctum personal access tokens. Use the CLI browser login, or generate a token from your application by submitting your author account credentials to the endpoint below.

POST /api/v1/tokens

Generate a new Bearer token.

cURL
curl -X POST https://bookbeam.app/api/v1/tokens \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "author@example.com",
    "password": "your-password",
    "name": "CLI Integration Token"
  }'
GET /api/v1/tokens

List active tokens for your account.

cURL
curl -X GET https://bookbeam.app/api/v1/tokens \
  -H "Authorization: Bearer $BOOKBEAM_TOKEN" \
  -H "Accept: application/json"
DELETE /api/v1/tokens/{token_id}

Revoke an active token by ID.

Book Projects

Book projects represent your books and manuscripts. Each project contains uploaded file assets and signup giveaway links.

GET /api/v1/projects

List all book projects for your active team.

cURL
curl -X GET https://bookbeam.app/api/v1/projects \
  -H "Authorization: Bearer $BOOKBEAM_TOKEN" \
  -H "Accept: application/json"
POST /api/v1/projects

Create a new book project (supports multipart for cover image).

cURL
curl -X POST https://bookbeam.app/api/v1/projects \
  -H "Authorization: Bearer $BOOKBEAM_TOKEN" \
  -F "title=The Quantum Detective" \
  -F "description=Detective Jack Hunter investigates across realities." \
  -F "cover_image=@/path/to/cover.jpg"
GET /api/v1/projects/{id}

Get project details with files & links.

PUT /api/v1/projects/{id}

Update book title or description.

DELETE /api/v1/projects/{id}

Delete project and all attached files.

GET /api/v1/projects/{id}/downloaders

List reader downloads and signups.

GET /api/v1/projects/{id}/export-downloaders

Export readers list as CSV download.

PUT /api/v1/projects/{id}/newsletter

Assign newsletter list ID to project.

Book Files

Upload and manage ebook assets for each book project. Supported formats: EPUB, MOBI, and PDF.

POST /api/v1/projects/{id}/files

Upload a new manuscript file (multipart/form-data).

cURL
curl -X POST https://bookbeam.app/api/v1/projects/1/files \
  -H "Authorization: Bearer $BOOKBEAM_TOKEN" \
  -F "file=@/path/to/novel.epub" \
  -F "format=epub"
GET .../files

List files uploaded for project.

GET .../files/{id}/download

Author binary file stream.

DELETE .../files/{id}

Delete file & purge storage.

Reader Distribution

Public endpoints for reader interaction. Embed book giveaways seamlessly into your custom web applications.

GET /api/v1/readers/links/{slug}

Fetch public landing metadata (title, author, formats) for a campaign link.

cURL
curl -X GET https://bookbeam.app/api/v1/readers/links/sample-slug \
  -H "Accept: application/json"
POST /api/v1/readers/links/{slug}/signup

Submit reader email to receive magic confirmation link.

cURL
curl -X POST https://bookbeam.app/api/v1/readers/links/sample-slug/signup \
  -H "Content-Type: application/json" \
  -d '{
    "email": "reader@example.com"
  }'
POST /api/v1/readers/confirm

Verify signed email confirmation link.

GET .../readers/files/{id}/download

Reader secure signed download stream.

Newsletters & Integrations

Automate subscriber syncing with major email marketing platforms: Mailcoach, MailerLite, and Kit (ConvertKit), or configure custom webhooks.

GET /api/v1/settings/newsletter

Retrieve active provider settings & status.

PUT /api/v1/settings/newsletter/provider

Save provider credentials (provider: mailcoach|mailerlite|kit, api_token).

DELETE /api/v1/settings/newsletter/provider

Disconnect active newsletter provider.

PUT /api/v1/settings/newsletter/webhook

Configure automated webhook delivery endpoint (webhook_url).

POST /api/v1/settings/newsletter/lists

Fetch audience lists dynamically from provider.

Telemetry & Billing

Retrieve real-time metrics, audit logs, and your active subscription status.

GET /api/v1/dashboard/metrics

Returns aggregate download and reader signup counts.

GET /api/v1/logs

Returns chronological audit events and user actions.

GET /api/v1/billing

Returns subscription status and active offer details.

Download OpenAPI 3.1 Spec

Import the BookBeam API specification directly into Postman, Insomnia, Swagger UI, or code generation tools to quickly scaffold SDKs and scripts.