# Open Library

> Search and retrieve open bibliographic data (books, works, editions, authors, subjects, and cover images) from Open Library, a free, keyless public API and an initiative of the Internet Archive. No account or API key is required.

App · Research & Academia · 9 actions. Web page: https://docs.lodol.com/docs/integrations/open-library

## Actions

### Get a book by ISBN

Look up the edition for an ISBN-10 or ISBN-13. Hyphens and spaces in the ISBN are ignored.

**Inputs**

- ISBN (`isbn`, text, required): The ISBN-10 or ISBN-13 (for example, 9780140328721).

**Outputs**

- `book` (object)

**Example output**

```json
{
  "book": {
    "authors": [
      {
        "key": "/authors/OL34184A"
      }
    ],
    "covers": [
      15152634,
      8739161
    ],
    "first_sentence": "Down in the valley there were three farms.",
    "isbn_10": [
      "0140328726"
    ],
    "isbn_13": [
      "9780140328721"
    ],
    "key": "/books/OL7353617M",
    "languages": [
      {
        "key": "/languages/eng"
      }
    ],
    "number_of_pages": 96,
    "publish_date": "October 1, 1988",
    "publishers": [
      "Puffin"
    ],
    "title": "Fantastic Mr. Fox",
    "type": {
      "key": "/type/edition"
    },
    "works": [
      {
        "key": "/works/OL45804W"
      }
    ]
  }
}
```

### Get a book cover URL

Build the URL of a book's cover image from an identifier. Choose the identifier type (ISBN, OCLC, LCCN, Open Library edition ID, or cover ID) and a size (small, medium, or large). For a work, use its cover ID: cover_i from Search books, or covers from Get a work. Returns the direct image URL. No request is made, so the URL is returned even if no cover exists for that identifier. Prefer cover or edition IDs for many covers: Open Library serves at most 100 covers every 5 minutes looked up by ISBN, OCLC or LCCN.

**Inputs**

- Identifier type (`key`, text, required): Which kind of identifier the value is. One of: `isbn`, `oclc` (OCLC number), `lccn`, `olid` (Open Library edition ID), `id` (Cover ID).
- Identifier value (`value`, text, required): The identifier value (for example, 9780140328721 for an ISBN, OL7353617M for an edition, or 8739161 for a cover ID).
- Size (`size`, text): The cover image size: S (small), M (medium), or L (large). One of: `S` (Small), `M` (Medium), `L` (Large). Default: `M`.

**Outputs**

- `cover_url` (text)

**Example output**

```json
{
  "cover_url": "https://covers.openlibrary.org/b/isbn/9780140328721-M.jpg"
}
```

### Get a work

Fetch a single work (a book across all its editions) by its Open Library work id, for example OL27448W. Accepts a bare id, a full key such as /works/OL27448W, or the work's page address. A work that was merged into another returns the one it was merged into, and text such as the description always comes back as plain text.

**Inputs**

- Work ID (`work_id`, text, required): The Open Library work id (for example, OL27448W).

**Outputs**

- `work` (object)

**Example output**

```json
{
  "work": {
    "authors": [
      {
        "author": {
          "key": "/authors/OL26320A"
        },
        "type": {
          "key": "/type/author_role"
        }
      }
    ],
    "covers": [
      14625765,
      11658206,
      13120659
    ],
    "description": "Originally published from 1954 through 1956, J.R.R. Tolkien's richly complex series ushered in a new age of epic adventure storytelling.",
    "key": "/works/OL27448W",
    "subjects": [
      "The Lord of the Rings",
      "Fiction",
      "English Fantasy fiction",
      "Fantasy fiction"
    ],
    "title": "The Lord of the Rings",
    "type": {
      "key": "/type/work"
    }
  }
}
```

### Get an author

Fetch a single author by their Open Library author id, for example OL26320A. Accepts a bare id, a full key such as /authors/OL26320A, or the author's page address. An author who was merged into another returns the one they were merged into, and the bio always comes back as plain text.

**Inputs**

- Author ID (`author_id`, text, required): The Open Library author id (for example, OL26320A).

**Outputs**

- `author` (object)

**Example output**

```json
{
  "author": {
    "bio": "John Ronald Reuel Tolkien (1892-1973) was a major scholar of the English language, specialising in Old and Middle English.",
    "birth_date": "3 January 1892",
    "death_date": "2 September 1973",
    "fuller_name": "John Ronald Reuel Tolkien",
    "key": "/authors/OL26320A",
    "name": "J.R.R. Tolkien",
    "personal_name": "J. R. R. Tolkien",
    "photos": [
      6155606,
      6433524
    ],
    "type": {
      "key": "/type/author"
    }
  }
}
```

### Get an edition

Fetch a single edition (a specific published version) by its Open Library edition id, for example OL7353617M. Accepts a bare id, a full key such as /books/OL7353617M, or the edition's page address. An edition that was merged into another returns the one it was merged into.

**Inputs**

- Edition ID (`edition_id`, text, required): The Open Library edition id (for example, OL7353617M).

**Outputs**

- `edition` (object)

**Example output**

```json
{
  "edition": {
    "authors": [
      {
        "key": "/authors/OL34184A"
      }
    ],
    "covers": [
      15152634,
      8739161
    ],
    "first_sentence": "Down in the valley there were three farms.",
    "isbn_10": [
      "0140328726"
    ],
    "isbn_13": [
      "9780140328721"
    ],
    "key": "/books/OL7353617M",
    "languages": [
      {
        "key": "/languages/eng"
      }
    ],
    "number_of_pages": 96,
    "publish_date": "October 1, 1988",
    "publishers": [
      "Puffin"
    ],
    "title": "Fantastic Mr. Fox",
    "type": {
      "key": "/type/edition"
    },
    "works": [
      {
        "key": "/works/OL45804W"
      }
    ]
  }
}
```

### Get author works

List the works written by an author, by their Open Library author id. Results are paginated with limit and offset. For an author who was merged into another, lists that author's works.

**Inputs**

- Author ID (`author_id`, text, required): The Open Library author id (for example, OL26320A).
- Limit (`limit`, number): How many works to return (1–1000). Defaults to 50. From 1 to 1000.
- Offset (`offset`, number): How many works to skip before returning results. At least 0.

**Outputs**

- `works` (object)

**Example output**

```json
{
  "works": {
    "entries": [
      {
        "authors": [
          {
            "author": {
              "key": "/authors/OL26320A"
            },
            "type": {
              "key": "/type/author_role"
            }
          }
        ],
        "covers": [
          14625765,
          11658206,
          13120659
        ],
        "description": "Originally published from 1954 through 1956, J.R.R. Tolkien's richly complex series ushered in a new age of epic adventure storytelling.",
        "key": "/works/OL27448W",
        "subjects": [
          "The Lord of the Rings",
          "Fiction",
          "English Fantasy fiction",
          "Fantasy fiction"
        ],
        "title": "The Lord of the Rings",
        "type": {
          "key": "/type/work"
        }
      }
    ],
    "links": {
      "author": "/authors/OL26320A",
      "next": "/authors/OL26320A/works.json?limit=1&offset=1",
      "self": "/authors/OL26320A/works.json?limit=1"
    },
    "size": 346
  }
}
```

### Get books by subject

Fetch the books filed under a subject, for example fantasy or science fiction. The subject name is matched case-insensitively. People, places and times are subjects too, written with a prefix such as person:gandalf or place:london, and a subject key from another result, such as /subjects/person:gandalf, can be passed as it is.

**Inputs**

- Subject (`subject`, text, required): The subject name (for example, science fiction).
- Details (`details`, true/false): Set to true to also include related subjects, authors, publishers, and publishing history.
- Ebooks (`ebooks`, true/false): Set to true to only include works with an e-book available.
- Published in (`published_in`, text): Only include works with an edition published in this year or range of years (for example, 1954 or 1950-1960).
- Limit (`limit`, number): How many works to return (1–1000). Defaults to 12. From 1 to 1000.
- Offset (`offset`, number): How many works to skip before returning results. At least 0.

**Outputs**

- `subject` (object)

**Example output**

```json
{
  "subject": {
    "authors": [
      {
        "count": 4,
        "key": "/authors/OL26320A",
        "name": "J.R.R. Tolkien"
      }
    ],
    "ebook_count": 5,
    "key": "/subjects/hobbits",
    "name": "Hobbits",
    "people": [
      {
        "count": 4,
        "key": "/subjects/person:gandalf",
        "name": "Gandalf"
      }
    ],
    "places": [
      {
        "count": 3,
        "key": "/subjects/place:rivendell",
        "name": "Rivendell"
      }
    ],
    "publishers": [
      {
        "count": 3,
        "key": "/publishers/Allen_&_Unwin",
        "name": "Allen & Unwin"
      }
    ],
    "publishing_history": [
      [
        1937,
        1
      ],
      [
        1938,
        1
      ]
    ],
    "subject_type": "subject",
    "subjects": [
      {
        "count": 4,
        "key": "/subjects/fantasy",
        "name": "Fantasy"
      }
    ],
    "times": [
      {
        "count": 1,
        "key": "/subjects/time:third-age",
        "name": "Third-Age"
      }
    ],
    "work_count": 7,
    "works": [
      {
        "authors": [
          {
            "key": "/authors/OL26320A",
            "name": "J.R.R. Tolkien"
          }
        ],
        "cover_edition_key": "OL51711263M",
        "cover_id": 14627509,
        "edition_count": 481,
        "first_publish_year": 1937,
        "has_fulltext": true,
        "ia": "hobbitortherebac00tolk_2",
        "key": "/works/OL27482W",
        "public_scan": false,
        "title": "The Hobbit"
      }
    ]
  }
}
```

### Search authors

Search Open Library for authors by name. Returns matching authors with their Open Library author ids, which can be used with the Get author and Get author works actions.

**Inputs**

- Search query (`query`, text, required): The author name to search for (for example, mark twain).
- Page (`page`, number): Which page of results to return (starts at 1). At least 1.
- Limit (`limit`, number): How many results per page (1–100). Defaults to 100. From 1 to 100.

**Outputs**

- `results` (object)

**Example output**

```json
{
  "results": {
    "docs": [
      {
        "alternate_names": [
          "J. R. R. Tolkien",
          "John Ronald Reuel Tolkien"
        ],
        "birth_date": "3 January 1892",
        "death_date": "2 September 1973",
        "key": "OL26320A",
        "name": "J.R.R. Tolkien",
        "top_work": "The Hobbit",
        "work_count": 346
      }
    ],
    "numFound": 2,
    "numFoundExact": true,
    "start": 0
  }
}
```

### Search books

Search Open Library for books and works. Provide a general query and/or narrow by title, author, or subject. This is the best way to look up many books at once; prefer it over fetching single books repeatedly. Results are works (a book across all its editions) and are paginated.

**Inputs**

- Search query (`query`, text): A general search term matched across title, author, and more (for example, the lord of the rings). Optional if you supply a title, author, or subject instead.
- Title (`title`, text): Restrict the search to this book title.
- Author (`author`, text): Restrict the search to this author's name.
- Subject (`subject`, text): Restrict the search to this subject (for example, fantasy).
- Sort (`sort`, text): How to order the results. Defaults to relevance. One of: `new` (Newest first), `old` (Oldest first), `title` (Title (A–Z)), `rating` (Highest rated), `editions` (Most editions), `random`.
- Language (`language`, text): Preferred results language as a two-letter ISO 639-1 code (for example, en or fr).
- Fields (`fields`, text): Comma-separated list of fields to return (for example, key,title,author_name,first_publish_year). Use * to fetch all fields. Leave empty for the default set.
- Page (`page`, number): Which page of results to return (starts at 1). At least 1.
- Limit (`limit`, number): How many results per page (1–100). Defaults to 100. From 1 to 100.

**Outputs**

- `results` (object)

**Example output**

```json
{
  "results": {
    "docs": [
      {
        "author_key": [
          "OL26320A"
        ],
        "author_name": [
          "J.R.R. Tolkien"
        ],
        "cover_edition_key": "OL51694024M",
        "cover_i": 14625765,
        "ebook_access": "borrowable",
        "edition_count": 253,
        "first_publish_year": 1954,
        "has_fulltext": true,
        "ia": [
          "lordofrings00tolk_5"
        ],
        "key": "/works/OL27448W",
        "language": [
          "eng",
          "fre",
          "ger"
        ],
        "public_scan_b": false,
        "title": "The Lord of the Rings"
      }
    ],
    "numFound": 1106,
    "numFoundExact": true,
    "num_found": 1106,
    "q": "the lord of the rings",
    "start": 0
  }
}
```
