Book402 exposes a REST API at https://book402.com. All responses are JSON.

Base URL

https://book402.com

Endpoint Summary

graph TD subgraph Free["🆓 Free Endpoints"] A["/books"] --> A1["List & search books"] B["/books/:id"] --> B1["Single book details"] C["/genres"] --> C1["List all genres"] D["/stats"] --> D1["Database statistics"] end subgraph Paid["💰 Paid Endpoints (x402)"] E["/search/hybrid?q="] --> E1["$0.01 — BM25 + vector search"] F["/search/summaries?q="] --> F1["$0.01 — Search in summaries"] G["/books/:id/summary"] --> G1["$0.05 — Full book summary"] end subgraph Graph["📊 Graph"] H["/graph"] --> H1["Three.js visualization"] I["/graph/data"] --> I1["Graph nodes + edges JSON"] J["/graph/book/:id"] --> J1["Book neighbors"] end

Response Format

All endpoints return JSON:

{
  "data": [...],
  "total": 100,
  "page": 1,
  "limit": 20
}

Error Responses

Status Meaning
200 Success
402 Payment Required — send x402 payment header
404 Resource not found
500 Internal server error

CORS

All endpoints support CORS with Access-Control-Allow-Origin: *.

Rate Limiting

Free endpoints have no explicit rate limit but please be reasonable. Paid endpoints are naturally rate-limited by payment cost.

Caching

Responses include Cache-Control: public, max-age=3600 — book data doesn't change frequently.