{"openapi": "3.1.0", "info": {"title": "Earshelf API", "version": "1.0", "description": "Turn a DRM-free book into a chaptered audiobook. The book's secret is its private capability. Payment is by Stripe Checkout, done by a human."}, "servers": [{"url": "https://earshelf.vibefrontier.com"}], "components": {"securitySchemes": {"bookSecret": {"type": "apiKey", "in": "header", "name": "Authorization", "description": "`Book <secret>`, the secret returned when the book was created."}}}, "paths": {"/api/books": {"post": {"summary": "Create a book from an upload (raw body or multipart), or JSON {text|url}", "parameters": [{"name": "rights", "in": "query", "schema": {"type": "string", "enum": ["1"]}, "description": "Required for raw uploads: confirms ownership/public domain, no DRM."}, {"name": "X-Filename", "in": "header", "schema": {"type": "string"}}], "requestBody": {"content": {"application/octet-stream": {"schema": {"type": "string", "format": "binary"}}, "multipart/form-data": {"schema": {"type": "object", "properties": {"file": {"type": "string", "format": "binary"}, "rights": {"type": "string"}, "email": {"type": "string"}}}}, "application/json": {"schema": {"type": "object", "properties": {"text": {"type": "string"}, "url": {"type": "string"}, "title": {"type": "string"}, "author": {"type": "string"}, "rights": {"type": "boolean"}, "email": {"type": "string"}}}}}}, "responses": {"201": {"description": "Created: {id, secret, url, path, price_cents, chars}"}, "413": {"description": "Too large"}, "422": {"description": "Refused (DRM, scan, ...)"}}}}, "/api/books/{id}": {"get": {"summary": "Book status, chapters, progress, downloads", "security": [{"bookSecret": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "OK"}}}, "delete": {"summary": "Delete the book and revoke its secret", "security": [{"bookSecret": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "OK"}}}}, "/api/books/{id}/voice": {"post": {"summary": "Set voice, speed, included chapters or email before paying", "security": [{"bookSecret": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string"}}], "requestBody": {"content": {"application/json": {"schema": {"type": "object", "properties": {"voice": {"type": "string"}, "speed": {"type": "number", "minimum": 0.8, "maximum": 1.3}, "include": {"type": "array", "items": {"type": "integer"}}, "email": {"type": "string"}}}}}}, "responses": {"200": {"description": "OK"}}}}, "/api/books/{id}/preview": {"post": {"summary": "Start the free first 30 minutes (once)", "security": [{"bookSecret": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "OK"}}}}, "/api/books/{id}/checkout": {"post": {"summary": "Stripe Checkout URL for the whole audiobook; give it to the human who pays", "security": [{"bookSecret": []}], "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "OK"}}}}, "/mcp": {"post": {"summary": "Model Context Protocol (Streamable HTTP, JSON-RPC 2.0)", "responses": {"200": {"description": "OK"}}}}}}