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/v1Every 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_xxxxxxxxxxxxxxxxxxxxxxxxxxxxAPI 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
Full API reference is available in our documentation. See how the API powers pipeline automation and enterprise workflows.
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:
project.created— A new book project was createdchapter.drafted— A chapter draft has been generatedchapter.edited— The AI editing pass completedproject.exported— A project was exported to a file formatproject.published— A book was published via KDP or other channel
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:
- Starter: 100 requests/minute, 500K words/month
- Professional: 500 requests/minute, 5M words/month
- Enterprise: Custom limits, dedicated throughput, no word caps
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
