{"openapi":"3.1.0","info":{"title":"BookBot","description":"BookBot exposes paid agent tools for two libraries: ebooks on Anna's Archive (EPUB download links) and audiobooks on audiobookbay.lu (BitTorrent magnet links). Paid routes accept USDC on Base via x402 and Tempo USDC via MPP.","version":"1.1.0","x-guidance":"# BookBot API\n\nPaid agent tools for finding ebooks and audiobooks.\n\n## Ebook endpoints (Anna's Archive)\n\n- **POST /api/books/find** ($0.50) — Full agent: resolve an EPUB download link from a book title (and optional author) in one call.\n- **POST /api/books/search** ($0.10) — Search Anna's Archive; returns up to 10 result entries with URLs.\n- **POST /api/books/download-link** ($0.10) — Resolve a direct EPUB download URL from an Anna's Archive result page URL.\n\n## Audiobook endpoints (audiobookbay.lu)\n\n- **POST /api/audiobooks/search** ($0.005) — Search audiobookbay.lu; returns up to ~12 entries with title, slug, cover, category, language, and keywords.\n- **POST /api/audiobooks/details** ($0.02) — Fetch full metadata + a magnet URI (info hash + all backup trackers) for one audiobook by slug.\n\n## Typical flows\n\n**Ebook**: call `/api/books/search` with `{ bookName, author? }` to list candidates, then pass a result `url` to `/api/books/download-link` for the final EPUB URL. Or skip both and call `/api/books/find` for the agent to do the full pipeline in one paid request.\n\n**Audiobook**: call `/api/audiobooks/search` with `{ query }` to find titles, then pass a result `slug` to `/api/audiobooks/details` to get a ready-to-use magnet link.\n\nAll routes accept JSON bodies and return JSON. Unauthenticated requests receive HTTP 402 with an x402/MPP payment challenge.","guidance":"# BookBot API\n\nPaid agent tools for finding ebooks and audiobooks.\n\n## Ebook endpoints (Anna's Archive)\n\n- **POST /api/books/find** ($0.50) — Full agent: resolve an EPUB download link from a book title (and optional author) in one call.\n- **POST /api/books/search** ($0.10) — Search Anna's Archive; returns up to 10 result entries with URLs.\n- **POST /api/books/download-link** ($0.10) — Resolve a direct EPUB download URL from an Anna's Archive result page URL.\n\n## Audiobook endpoints (audiobookbay.lu)\n\n- **POST /api/audiobooks/search** ($0.005) — Search audiobookbay.lu; returns up to ~12 entries with title, slug, cover, category, language, and keywords.\n- **POST /api/audiobooks/details** ($0.02) — Fetch full metadata + a magnet URI (info hash + all backup trackers) for one audiobook by slug.\n\n## Typical flows\n\n**Ebook**: call `/api/books/search` with `{ bookName, author? }` to list candidates, then pass a result `url` to `/api/books/download-link` for the final EPUB URL. Or skip both and call `/api/books/find` for the agent to do the full pipeline in one paid request.\n\n**Audiobook**: call `/api/audiobooks/search` with `{ query }` to find titles, then pass a result `slug` to `/api/audiobooks/details` to get a ready-to-use magnet link.\n\nAll routes accept JSON bodies and return JSON. Unauthenticated requests receive HTTP 402 with an x402/MPP payment challenge.","contact":{"name":"BookBot","url":"https://book-bot.app"}},"servers":[{"url":"https://book-bot.app"}],"tags":[{"name":"Audiobooks"},{"name":"Books"}],"paths":{"/api/books/find":{"post":{"operationId":"books_find","summary":"Find an EPUB download link for a book by title using the BookBot agent. Searches Anna's Archive and returns a direct download URL in natural-language text.","tags":["Books"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.50"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookName":{"type":"string","minLength":1,"description":"The title of the book to search for."},"author":{"description":"The author of the book (optional).","type":"string"}},"required":["bookName"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"Natural-language response containing the resolved EPUB download link."}},"required":["text"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}},"/api/books/search":{"post":{"operationId":"books_search","summary":"Search Anna's Archive for matching books. Returns up to 10 result entries with URLs that can be passed to /api/books/download-link.","tags":["Books"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.10"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bookName":{"type":"string","minLength":1,"description":"The title of the book to search for."},"author":{"description":"The author of the book (optional).","type":"string"}},"required":["bookName"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"books":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","description":"Anna's Archive result page URL. Pass this to /api/books/download-link to resolve the EPUB."},"thumbnail":{"type":"string","format":"uri","description":"Cover image URL."},"title":{"type":"string"},"author":{"type":"string"},"details":{"type":"string","description":"Free-text details such as format, file size, and language (e.g. 'epub · 1.2 MB · 1925')."}},"required":["url","thumbnail","title","author","details"],"additionalProperties":false}}},"required":["books"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}},"/api/books/download-link":{"post":{"operationId":"books_download-link","summary":"Resolve a direct EPUB download URL from an Anna's Archive result page URL produced by /api/books/search.","tags":["Books"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.10"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"The Anna's Archive result page URL (returned by /api/books/search), e.g. https://annas-archive.org/md5/abc123."}},"required":["url"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"The resolved direct EPUB download URL, or 'No results found' when the page has no fast-download link."}},"required":["url"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}},"/api/audiobooks/search":{"post":{"operationId":"audiobooks_search","summary":"Search audiobookbay.lu for audiobooks. Returns up to ~12 result entries with slugs that can be passed to /api/audiobooks/details for magnet links.","tags":["Audiobooks"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.005"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":200,"description":"Search query (title, author, or narrator)."},"page":{"description":"Page number, defaults to 1.","type":"integer","minimum":1,"maximum":20}},"required":["query"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"audiobooks":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"audiobookbay.lu detail page URL. Pass the `slug` to /api/audiobooks/details for a magnet link."},"slug":{"type":"string","description":"Audiobook slug — pass this to /api/audiobooks/details."},"title":{"type":"string"},"thumbnail":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cover image URL, or null if missing."},"category":{"type":"array","items":{"type":"string"}},"language":{"anyOf":[{"type":"string"},{"type":"null"}]},"keywords":{"type":"array","items":{"type":"string"}}},"required":["url","slug","title","thumbnail","category","language","keywords"],"additionalProperties":false}}},"required":["audiobooks"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}},"/api/audiobooks/details":{"post":{"operationId":"audiobooks_details","summary":"Fetch full metadata and a magnet download link for one audiobook on audiobookbay.lu. Returns title, author, narrators, format, length, description, info hash, tracker list, and the assembled magnet URI.","tags":["Audiobooks"],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.02"},"protocols":[{"x402":{}},{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":300,"pattern":"^[a-z0-9-]+$","description":"Audiobook slug returned by /api/audiobooks/search (e.g. \"dune-frank-herbert-2\")."}},"required":["slug"]}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"slug":{"type":"string"},"title":{"type":"string"},"author":{"anyOf":[{"type":"string"},{"type":"null"}]},"narrators":{"type":"array","items":{"type":"string"}},"format":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Container format, e.g. \"M4B\", \"MP3\"."},"bitrate":{"anyOf":[{"type":"string"},{"type":"null"}]},"length":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Runtime, e.g. '21 hours and 2 minutes'."},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"thumbnail":{"anyOf":[{"type":"string"},{"type":"null"}]},"fileSize":{"anyOf":[{"type":"string"},{"type":"null"}]},"infoHash":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"40-character SHA-1 BitTorrent info hash, hex-encoded."},"trackers":{"type":"array","items":{"type":"string"},"description":"All announce URLs from the torrent."},"magnet":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Ready-to-use magnet: URI with info hash + all trackers. Null if the source page lacks an info hash."}},"required":["url","slug","title","author","narrators","format","bitrate","length","description","thumbnail","fileSize","infoHash","trackers","magnet"],"additionalProperties":false}}}},"402":{"description":"Payment Required"}}}}}}