xBookvideo API
Book-to-Video SaaS API โ Upload books, auto-generate episode plans, AI creates short videos.
Base URL: https://xbookvideo.com
Version: 1.0.0
Authentication
Method 1: API Key (Recommended for programmatic use)
Pass the API Key in the request header. Two header formats supported:
# Method A: X-API-Key header
curl -H "X-API-Key: xbk_your_api_key_here" \
https://xbookvideo.com/api/v1/auth/me
# Method B: Authorization Bearer
curl -H "Authorization: Bearer xbk_your_api_key_here" \
https://xbookvideo.com/api/v1/auth/me
API Key format: xbk_ prefix + 32 random characters.
๐ Create and manage API Keys in Settings โ API Keys.
Note: API Key is shown in plain text only once at creation. Save it securely. If lost, create a new one.
Method 2: JWT Token (Web frontend)
curl -H "Authorization: Bearer " \
https://xbookvideo.com/api/v1/auth/me
JWT Token is valid for 72 hours. Obtain it via /api/v1/auth/login.
Permission Scopes
| Scope | Description |
read | Read projects/videos/plans |
write | Create/update project content |
render | Trigger rendering (plan, demo, full) |
Rate Limits
| Plan | Requests/min | Heavy endpoints |
| Free | 10 | 10/min |
| Standard | 30 | 10/min |
| Premium / Creator / Pro | 60 | 10/min |
| Studio / Enterprise | 120 | 10/min |
Rate limit response includes these headers:
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 7
X-RateLimit-Reset: 1721820000
When exceeded, returns 429 Too Many Requests.
API Endpoints
Authentication & API Keys
| Method | Path | Description |
| POST | /api/v1/auth/register | Register user |
| POST | /api/v1/auth/login | Login |
| GET | /api/v1/auth/me | Get current user info |
| GET | /api/v1/auth/projects | List user projects |
| POST | /api/v1/api-keys | Create API Key |
| GET | /api/v1/api-keys | List API Keys |
| DELETE | /api/v1/api-keys/{id} | Delete API Key |
| PATCH | /api/v1/api-keys/{id}/toggle | Enable/disable API Key |
Book Upload & Writing
| Method | Path | Description |
| POST | /api/v1/upload | Upload book file (PDF/DOCX/TXT/EPUB) |
| GET | /api/v1/projects/{id}/content | Get text content |
Episode Planning & Rendering
| Method | Path | Description |
| POST | /api/v1/plan | Generate episode plan (async) |
| GET | /api/v1/projects/{id}/plan | Get episode plan result |
| POST | /api/v1/generate-demo | Generate demo (first episode free) |
| GET | /api/v1/projects/{id}/status | Query rendering progress |
| GET | /api/v1/queue/status | Rendering queue status |
Videos & Downloads
| Method | Path | Description |
| GET | /api/v1/projects/{id}/videos | Get video list |
| GET | /api/v1/projects/{id}/videos/{ep}/stream | Video stream |
| GET | /api/v1/projects/{id}/videos/{ep}/download | Download video (paid) |
Payment
| Method | Path | Description |
| POST | /api/v1/payment/create | Create payment order |
| POST | /api/v1/payment/creem-webhook | Creem payment webhook |
Sharing & Compression
| Method | Path | Description |
| POST | /api/v1/projects/{id}/share/compress | Compress video (YouTube/TikTok) |
| GET | /api/v1/projects/{id}/share/text | Get share text |
| GET | /api/v1/projects/{id}/share/card | Generate share card |
Knowledge Index & Search
| Method | Path | Description |
| POST | /api/v1/projects/{id}/index | Vector index |
| POST | /api/v1/projects/{id}/search | In-project semantic search |
| POST | /api/v1/search | Cross-project search |
Google Books & Public Domain
| Method | Path | Description |
| GET | /api/v1/google-books/search | Google Books search |
| GET | /api/v1/public-domain/search | Public domain book search |
| GET | /api/v1/public-domain/import | Public domain book import |
Code Examples
Python
import httpx
API_KEY = "xbk_your_api_key_here"
BASE_URL = "https://xbookvideo.com"
# 1. Upload book
with open("book.pdf", "rb") as f:
resp = httpx.post(
f"{BASE_URL}/api/v1/upload",
headers={"X-API-Key": API_KEY},
files={"file": ("book.pdf", f, "application/pdf")},
)
project_id = resp.json()["project_id"]
# 2. Generate episode plan
httpx.post(
f"{BASE_URL}/api/v1/plan",
headers={"X-API-Key": API_KEY, "Content-Type": "application/json"},
json={"project_id": project_id, "total_episodes": 12},
)
# 3. Poll plan progress
import time
while True:
status = httpx.get(
f"{BASE_URL}/api/v1/projects/{project_id}/status",
headers={"X-API-Key": API_KEY},
).json()
if status["status"] in ("planned", "demo_ready", "completed"):
break
time.sleep(5)
# 4. Generate demo
httpx.post(
f"{BASE_URL}/api/v1/generate-demo",
headers={"X-API-Key": API_KEY, "Content-Type": "application/json"},
json={"project_id": project_id, "episode_indices": [0, 1]},
)
# 5. Get video list
videos = httpx.get(
f"{BASE_URL}/api/v1/projects/{project_id}/videos",
headers={"X-API-Key": API_KEY},
).json()
for v in videos["videos"]:
print(f"Episode {v['episode']}: {v['title']} ({v['duration']:.0f}s)")
cURL โ Create API Key
# First login with JWT to get token
TOKEN=$(curl -s -X POST https://xbookvideo.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"your_username","password":"your_password"}' \
| python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
# Create API Key
curl -X POST https://xbookvideo.com/api/v1/api-keys \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"My Production Key","scopes":"read,write,render"}'
# List API Keys
curl https://xbookvideo.com/api/v1/api-keys \
-H "Authorization: Bearer $TOKEN"
JavaScript (Node.js)
const API_KEY = "xbk_your_api_key_here";
const BASE = "https://xbookvideo.com";
// Upload book
const formData = new FormData();
formData.append("file", fs.createReadStream("book.pdf"));
const uploadRes = await fetch(`${BASE}/api/v1/upload`, {
method: "POST",
headers: { "X-API-Key": API_KEY },
body: formData,
});
const { project_id } = await uploadRes.json();
// Generate episode plan
await fetch(`${BASE}/api/v1/plan`, {
method: "POST",
headers: {
"X-API-Key": API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ project_id, total_episodes: 12 }),
});
// Query progress
const status = await fetch(
`${BASE}/api/v1/projects/${project_id}/status`,
{ headers: { "X-API-Key": API_KEY } }
).then(r => r.json());
console.log("Status:", status.status, "Progress:", status.progress);
Error Codes
| HTTP Status | Meaning | Common Causes |
| 400 | Bad Request | Missing params / invalid format |
| 401 | Unauthorized | API Key invalid/expired/missing |
| 403 | Forbidden | Insufficient permissions (e.g. non-Studio accessing white-label) |
| 404 | Not Found | Project/video/key not found |
| 429 | Too Many Requests | Rate limit exceeded |
| 503 | Service Unavailable | LLM/image/payment service not configured |
xBookvideo API ยท
โ Back to App