{"body": {"type": "/type/text", "value": "Our Covers API provides a programmatic method to access the book covers and author photos available in the Open Library Covers Repository.\r\n\r\n<h2>Guidelines for Cover Use</h2>\r\n\r\n 1. Please, **do not crawl our cover API**. If you do, we may decide to block your crawl. Our covers are available for download in bulk on archive.org ([example][1]), but, it's a bit of a jungle in there, and is updated regularly. \r\n 2. If you want to display covers on public-facing pages, please use a src URL that points to covers.openlibrary.org. For example, if you'd like to call a cover using an ISBN, you can do it like this: <br />`<img src=\"https://covers.openlibrary.org/b/isbn/9780385533225-S.jpg\" />`\r\n 3. A courtesy link back to Open Library is appreciated, whether it be on each individual book's page (where you can link back to the book's page on Open Library, for example, using the same ISBN `https://openlibrary.org/isbn/9780385533225`), or on your About page or in your footer. \r\n\r\nThanks!\r\n\r\n<h2>How To</h2>\r\n\r\nBook covers can be accessed using Cover ID (internal cover ID), OLID (Open Library ID), ISBN, OCLC, and LCCN.\r\n\r\nThe covers are available in 3 sizes: \r\n\r\n 1. <b>S</b>: Small, suitable for use as a thumbnail on a <a href=\"https://openlibrary.org/works/OL5734718W/Little_Brother#lists-section\">lists section of a work</a> on Open Library, \r\n 2. <b>M</b>: Medium, suitable for display on a <a href=\"https://openlibrary.org/books/OL5218962M\">details page</a> on Open Library and,\r\n 3. <b>L</b>: Large\r\n\r\nThe URL pattern to access book covers is:\r\n\r\n`https://covers.openlibrary.org/b/$key/$value-$size.jpg`\r\n\r\nWhere:\r\n\r\n - `key` can be any one of ISBN, OCLC, LCCN, OLID and ID (case-insensitive)\r\n - `value` is the value of the chosen key\r\n - `size` can be one of S, M and L for small, medium and large respectively.\r\n\r\nBy default it returns a blank image if the cover cannot be found. If you append `?default=false` to the end of the URL, then it returns a 404 instead.\r\n\r\nThe following example returns small sized cover image for book with ISBN 0385472579.\r\n\r\n<a href=\"https://covers.openlibrary.org/b/isbn/0385472579-S.jpg\">https://covers.openlibrary.org/b/isbn/0385472579-S.jpg</a>\r\n\r\nThe same cover can be accessed in multiple ways using different keys:\r\n\r\n<img src=\"https://covers.openlibrary.org/b/isbn/0385472579-S.jpg\" /><br />\r\n\r\n - https://covers.openlibrary.org/b/id/240727-S.jpg\r\n - https://covers.openlibrary.org/b/olid/OL7440033M-S.jpg\r\n - https://covers.openlibrary.org/b/isbn/0385472579-S.jpg\r\n - https://covers.openlibrary.org/b/isbn/9780385472579-S.jpg\r\n - https://covers.openlibrary.org/b/lccn/93005405-S.jpg\r\n - https://covers.openlibrary.org/b/oclc/28419896-S.jpg\r\n\r\n<h2>Author Photos</h2>\r\n\r\nAuthor photos can be accessed using OLID and ID.\r\n\r\nThe URL Pattern for accessing author photos is:\r\n\r\n`https://covers.openlibrary.org/a/$key/$value-$size.jpg`\r\n\r\nFor example the following is the photograph of <a href=\"https://openlibrary.org/a/OL229501A\">Donald E. Knuth</a> from the Open Library.\r\n\r\n<img src=\"https://covers.openlibrary.org/a/id/3365456-S.jpg\" />\r\n\r\n   * https://covers.openlibrary.org/a/olid/OL229501A-S.jpg\r\n\r\n  [1]: https://www.archive.org/details/covers_0005\r\n  \r\n<a name=\"rate-limiting\">&nbsp;</a>\r\n\r\n<h2>Cover Size & API Access</h2>\r\n\r\nYou can add `.json` to end end of cover urls to return API information about the cover, e.g. `https://covers.openlibrary.org/b/id/12547191.json`.\r\n\r\nOne can fetch the image off-screen and use it's width/height:\r\n\r\n<pre>\r\nasync function fetchImage(url) {\r\n    const img = new Image();\r\n    return new Promise((res, rej) => {\r\n        img.onload = () => res(img);\r\n        img.onerror = e => rej(e);\r\n        img.src = url;\r\n    });\r\n}\r\n\r\nconst img = await fetchImage('https://covers.openlibrary.org/b/id/12547191-L.jpg');\r\nconst w = img.width;\r\nconst h = img.height;\r\n</pre>\r\n\r\nThis one way one won't need to make two separate requests per image! The browser won't make a second request for the image if you set the src of your visible `<img>` element after fetching it in this way.\r\n\r\n<h2>Rate Limiting</h2>\r\n\r\nThe cover access by ids other than CoverID and OLID are rate-limited. Currently only 100 requests/IP are allowed for every 5 minutes. \r\n\r\nIf any IP tries to access more that the allowed limit, the service will return \"403 Forbidden\" status.\r\n\r\n<a name=\"bulk-access\">&nbsp;</a>\r\n\r\n<h2>Bulk Access</h2>\r\n\r\nThe covers API is intended for displaying covers on public facing websites and not for bulk download.\r\n\r\nIf you are interested to download the covers in bulk, please download them from:\r\n\r\n* Small Covers: \r\n\r\n    * <https://www.archive.org/details/s_covers_0000>\r\n    * ...\r\n    * <https://www.archive.org/details/s_covers_0006>\r\n\r\n* Medium Covers:\r\n\r\n    * <https://www.archive.org/details/m_covers_0000>\r\n    * ...\r\n    * <https://www.archive.org/details/m_covers_0006>\r\n\r\n* Large Covers:\r\n\r\n    * <https://www.archive.org/details/l_covers_0000>\r\n    * ...\r\n    * <https://www.archive.org/details/l_covers_0006>\r\n\r\n* Original Covers:\r\n\r\n    * <https://www.archive.org/details/covers_0000>\r\n    * ...\r\n    * <https://www.archive.org/details/covers_0005>\r\n    \r\nEach of these archive.org items have 100 tar files, each containing 10K images in each. The names of these files are based on the cover ids. For example, `s_covers_0005_32.tar` file contains images for CoverIDs from `5320000` to `5329999`.\r\n\r\nThe mapping from various IDs to CoverIDs is available at:\r\n\r\n<https://www.archive.org/download/ol_dump_2011-03-31/ol_dump_coverids_2011-03-31.txt.gz>\r\n\r\nIt has 4 columns ID-Name, ID-Value, OL-KEY and CoverID."}, "title": "Open Library Covers API", "m": "edit", "key": "/dev/docs/api/covers", "type": {"key": "/type/page"}, "latest_revision": 35, "revision": 35, "created": {"type": "/type/datetime", "value": "2008-10-27T16:57:41.453943"}, "last_modified": {"type": "/type/datetime", "value": "2024-08-13T12:25:10.606396"}}