404 on /api/books
Problem
I'm getting a 404 from the books api:
PS C:\Users\James> curl.exe -sv 'https://openlibrary.org/api/books?bibkeys=ISBN:0451526538&jscmd=data&format=json' -o NUL
* Host openlibrary.org:443 was resolved.
* IPv6: (none)
* IPv4: 207.241.234.205
* Trying 207.241.234.205:443...
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* Connected to openlibrary.org (207.241.234.205) port 443
* using HTTP/1.x
> GET /api/books?bibkeys=ISBN:0451526538&jscmd=data&format=json HTTP/1.1
> Host: openlibrary.org
> User-Agent: curl/8.13.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 404 Not Found
< Server: nginx/1.30.5
< Date: Fri, 18 Sep 2026 07:53:07 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< access-control-allow-origin: *
< access-control-allow-method: GET, OPTIONS
< access-control-max-age: 86400
< x-ol-stats: ""
<
{ [5 bytes data]
* Connection #0 to host openlibrary.org left intact
Same ISBN works via the JSON URL.
Not sure if I'm doing something wrong or if the API's gone down, but the same API worked a week ago!
Reproducing the bug
No response
Context
No response
Breakdown
No response
Not sure what happened to /api/books, but /api/books.json can be used as an alternative while this is being sorted out.
https://openlibrary.org/api/books.json?bibkeys=ISBN:0451526538&jscmd=data&format=json
I’m interested in investigating this issue. Before starting implementation, could a maintainer confirm whether /api/books without the .json suffix is expected to remain supported? If so, I can trace the route registration and recent routing changes, reproduce the behavior locally, and identify whether the fix belongs in the application routes or deployment configuration.
Any updates on this issue?
I’m interested in investigating this issue. Before starting implementation, could a maintainer confirm whether /api/books without the .json suffix is expected to remain supported? If so, I can trace the route registration and recent routing changes, reproduce the behavior locally, and identify whether the fix belongs in the application routes or deployment configurat
@cdrini I looked into this, and to answer @Srijan229's question: the non-.json path is still meant to work. The FastAPI router registers both /api/books and /api/books.json (openlibrary/fastapi/books.py, same for the two /api/volumes/brief/... routes), and the Books API docs use /api/books?bibkeys=... without .json in every example.
What I see in production today:
| path | status |
|---|---|
/api/books?bibkeys=ISBN:0451526538 |
404 |
/api/books.json?bibkeys=ISBN:0451526538 |
200 |
/api/volumes/brief/isbn/0451526538 |
404 |
/api/volumes/brief/isbn/0451526538.json |
200 |
/api/volumes/brief/json/isbn:0451526538 |
404 |
/api/volumes/brief/json/isbn:0451526538.json |
200 |
The 404s come from web.py, not FastAPI: they carry the web.py-only Access-Control-Allow-Method header and an empty X-OL-Stats. So the non-.json requests are reaching web.py, which no longer has a handler for them. #13423 removed deprecated_handler.py, which used to catch exactly these paths (/api/books and /api/volumes/..., with and without json). I can't see the haproxy config, so I don't know if these paths worked in production before that change.
Two ways to fix it, as far as I can tell:
- Route
^/api/(books|volumes)without.jsonto FastAPI in the proxy config (staff only). - In the repo: add a small web.py handler that redirects these aliases to the
.jsonpath, keeping the query string. That works without a proxy change, but clients that don't follow redirects would still fail.
If option 2 is useful, I'd be happy to take it.
Fixed! Apologies for the interruption. There was a regression during an update last month. Both endpoints should be working again. Thank you to everyone who helped investigate!