Get Started →
Features Pricing Docs Blog Download Get Started →

WordStructor API — Integrate Book Generation Into Your Stack

The WordStructor REST API exposes every capability of the platform — outline creation, chapter drafting, editing, formatting, and publishing — as programmable endpoints. Build custom publishing workflows, integrate with your existing tools, or create your own frontend on top of WordStructor's AI engine.

Get API Access →

API Overview

The WordStructor API follows standard REST conventions. All requests and responses use JSON. Authentication is via API keys passed in the Authorization header. The base URL for all API requests is:

https://api.wordstructor.com/v1

Every response includes standard HTTP status codes, a request ID for tracing, and rate limit headers. The API is designed to be predictable and self-documenting — every endpoint accepts and returns structured JSON that maps directly to WordStructor's internal data model.

Authentication

Include your API key in every request:

Authorization: Bearer ws_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

API keys are generated from your WordStructor account settings. You can create multiple keys with scoped permissions — read-only, write, or admin. Rotate keys at any time without downtime (old keys continue working for a 24-hour grace period). Test keys with a ws_test_ prefix use our sandbox environment and never consume your production quota.

Core Endpoints

POST /projects Create a new book project
POST /projects/{id}/outline Set or update the book outline
POST /projects/{id}/draft Generate a chapter draft
POST /projects/{id}/edit Run AI editing pass
GET /projects/{id}/export/{format} Export as EPUB, PDF, or DOCX
POST /publish/kdp Submit directly to KDP

Full API reference is available in our documentation. See how the API powers pipeline automation and enterprise workflows.

WordStructor API dashboard showing endpoints and code examples

Code Examples

Here is how to generate a chapter using the WordStructor API in Python and JavaScript:

Python

import requests API_KEY = "ws_live_your_key_here" BASE_URL = "https://api.wordstructor.com/v1" headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } # Create a new project project = requests.post(f"{BASE_URL}/projects", json={ "title": "My First API Book", "model": "claude-4" }, headers=headers).json() # Set the outline outline = { "chapters": [ { "title": "Introduction", "description": "Overview of key concepts" }, { "title": "Getting Started", "description": "First steps and setup" } ] } requests.post(f"{BASE_URL}/projects/{project['id']}/outline", json=outline, headers=headers) # Draft chapter 1 draft = requests.post(f"{BASE_URL}/projects/{project['id']}/draft", json={ "chapter": 1, "word_count": 2000 }, headers=headers).json() print(f"Chapter drafted: {draft['word_count']} words")

JavaScript (Node.js)

const API_KEY = 'ws_live_your_key_here'; const BASE = 'https://api.wordstructor.com/v1'; async function generateBook() { const headers = { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }; // Create project const project = await fetch(`${BASE}/projects`, { method: 'POST', headers, body: JSON.stringify({ title: 'API Book', model: 'gpt-4o' }) }).then(r => r.json()); // Draft a chapter const draft = await fetch( `${BASE}/projects/${project.id}/draft`, { method: 'POST', headers, body: JSON.stringify({ chapter: 1, word_count: 2000 }) }).then(r => r.json()); console.log(`Generated ${draft.word_count} words`); }

Webhooks & Event System

In addition to the REST API, WordStructor supports outgoing webhooks that notify your system when events occur. Configure webhook URLs in your account settings and select which events to subscribe to:

Webhooks are delivered via HTTP POST with a JSON payload. Each delivery includes a signature header (X-WS-Signature) that you can verify using your webhook secret to ensure the request came from WordStructor. Retries happen with exponential backoff for up to 72 hours.

Webhooks pair perfectly with the automated book pipeline for fully unattended content production pipelines.

Rate Limits & Quotas

API rate limits depend on your plan tier:

Rate limit headers are returned with every response. If you exceed your limit, the API returns HTTP 429 with a Retry-After header indicating when to retry. For enterprise customers, we can provision dedicated API gateways with guaranteed throughput SLAs. See pricing for more details on plan comparisons.

Start Building with the WordStructor API

Get your API key today and start integrating AI book generation into your applications. Free tier includes 1,000 API calls to get you started.

Get Your API Key →

No credit card required · 14-day free trial