npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

isbnlab

v0.2.0

Published

Official TypeScript and JavaScript client for the ISBNLab book metadata API: books by ISBN, authors, publishers, BISAC genres, covers and ISBN conversion.

Readme

ISBNLab JavaScript and TypeScript client

The official JavaScript and TypeScript client for the ISBNLab book metadata API. Look up a book by ISBN and get its title, authors, publishers, series, BISAC genres, formats, page count, description and every other edition, from a catalog of more than 100 million editions. It also validates and converts ISBN-10, ISBN-13, EAN and Amazon ASIN.

Typed, with no runtime dependencies: it uses the built-in fetch of Node.js 18+, Deno, Bun and browsers. Works with import and require.

Install

npm install isbnlab

Get an API token

Create a free ISBNLab account and copy your API token from your profile. The Free plan includes 1,000 calls a day; see pricing for more.

Quick start

import { BooksApi, Configuration } from 'isbnlab';

const config = new Configuration({ accessToken: process.env.ISBNLAB_API_TOKEN });
const books = new BooksApi(config);

const book = await books.getBookByIsbn('9780765302304');

console.log(book.title);                       // The Gathering Storm
console.log(book.authors?.[0]?.name);          // Robert Jordan
console.log(book.publishDate?.getUTCFullYear());

console.log(book.otherEditionsCount, 'other editions');

Many fields are empty for some books, so every field is optional and may be null.

Linked records carry ids you can look up directly (author, publisher, subject and genre lookups need a Standard or Pro plan):

import { AuthorsApi } from 'isbnlab';

const authorId = book.authors?.[0]?.id;
if (authorId != null) {
  const author = await new AuthorsApi(config).getAuthor(String(authorId));
  console.log(author.bio);
}

Fields that depend on your plan

A book lookup lists the other editions (otherEditions, previousEdition, nextEdition) on the Pro plan. On the Free and Standard plans those fields are empty, otherEditionsCount still gives the number of other editions, and two response headers name what was left out: X-Plan-Restricted-Fields lists the fields and X-Plan-Upgrade links to the plans. restrictedFields() and upgradeUrl() read them from a ...Raw() call:

import { restrictedFields, upgradeUrl } from 'isbnlab';

const response = await books.getBookByIsbnRaw({ isbn: '9780765302304' });
const full = await response.value();

if (restrictedFields(response).includes('otherEditions')) {
  console.log(full.otherEditionsCount, 'other editions; see', upgradeUrl(response));
} else {
  for (const edition of full.otherEditions ?? []) {
    console.log(edition.isbn13, edition.title);
  }
}

restrictedFields(response) returns every field that was left out, for example ['otherEditions', 'previousEdition', 'nextEdition'], or [] when the response is complete. It also accepts a fetch Response or Headers.

A cover lookup (Standard or Pro) gives each cover image's URL in covers, and in sizes the same image 200, 400 and 800 pixels wide (w200, w400, w800); a width is empty when that size is not available.

const cover = await books.getBookCoverByIsbn('9780765302304');
console.log(cover.sizes?.[0]?.w400); // https://covers.isbnlab.com/w400/9780765302304.jpg

Errors

Any response other than 2xx rejects with ResponseError. Its response is the fetch Response, and the body's detail explains the reason:

import { ResponseError } from 'isbnlab';

try {
  await books.getBookByIsbn('9780000000000');
} catch (e) {
  if (!(e instanceof ResponseError)) throw e;

  const { detail } = await e.response.json();
  switch (e.response.status) {
    case 404: console.log('Not in the catalog'); break;
    case 429: console.log('Daily limit reached:', detail); break;
    case 403: console.log('Your plan does not include this endpoint:', detail); break;
    default: throw e;
  }
}

A network failure rejects with FetchError instead.

Keep your token out of browser code

Anyone can read a token that is shipped to the browser, so call the API from your server where you can. For tools that can't send headers, the API also accepts a URL key (it starts with ilq_ and is created on your profile) as a query parameter: new Configuration({ apiKey: 'ilq_...' }). It works only for GET requests and anyone who sees the URL can use it, so treat it as visible too.

What you can call

| Class | Method | Plan | |---|---|---| | BooksApi | getBookByIsbn(isbn), getBookByAsin(asin), getBookById(id) | Free | | IsbnApi | parseIsbn, isbn10ToIsbn13, isbn13ToIsbn10, isbnToEan, eanToIsbn, isbnToAsin, asinToIsbn | Free | | BooksApi | getBookCoverByIsbn(isbn), getBookCoverByAsin(asin) | Standard | | AuthorsApi | getAuthor(id), findAuthor(name) | Standard | | PublishersApi | getPublisher(id), findPublisher(name), getPublishersByPrefix(prefix) | Standard | | SubjectsApi | getSubject(id), findSubject(name) | Standard | | GenresApi | getGenre(id), findGenre(nameOrBisacCode) | Standard | | BooksApi | searchBooks(query, limit, page, maxResults) | Pro | | BooksApi | getEditionsByIsbn(isbn), getEditionsByAsin(asin) | Pro |

Every method also has a ...Raw() version that returns the full response, for example to read the rate-limit headers:

const response = await books.getBookByIsbnRaw({ isbn: '9780765302304' });
console.log(response.raw.headers.get('X-RateLimit-Remaining'));
const book = await response.value();

Field-by-field documentation: API documentation.

Development

src/ is generated from the API's OpenAPI document with OpenAPI Generator, so changes to it are made in the generator and arrive with the next release; please open an issue rather than a pull request for that folder. README.md, package.json, the build configuration and test/ are maintained by hand.

npm install
npm run typecheck
npm test
npm run build && npm run test:dist

License

MIT. Maintained by ISBNLab, the book metadata API.