It looks like you're offline.
Open Library logo
additional options menu
Last edited by jachamp
March 2, 2022 | History

Open Library JSON API

Read API

Infogami provides an API to query the database for objects matching particular criteria or to get an object from the database. All the requests take input either as part of the URL or query string. You can try sample requests and practice building requests in the API sandbox.

The database structure, developed by the Open Library, is called infogami. Infogami stores a collection of objects, called "things". For example, on the Open Library site, each page, book, author, and user is a thing in the database. Each thing then has a series of arbitrary key-value pairs as properties. For example, a book thing may have the key "title" with the value "A Heartbreaking Work of Staggering Genius" and the key "genre" with the value "Memoir". Each collection of key-value pairs is stored as a version, along with the time it was saved and the person who saved it.

Because in infogami everything is an object, you can query for any object in infogami space, such as templates, editions, authors, or individual infogami fields in any page type. Each object has an object type. (List of types.) For example, there is /type/edition which represents all of the information about a book, and type/edition/isbn_10 which is the property for the 10-character ISBN in the edition record.


Querying for Objects (/things)

To find objects matching a particular query, send a GET request to with query as parameter. In this documentation we use curl as a simple command line query client; any software that supports http GET can be used.

The query must use JSON dictionary syntax.

This query searches for all editions with a particular ISBN value, and returns the keys of all matching records. Since there can be only one book with the any ISBN, the result contains only one key. (In practice unfortunately you will see publishers have reused an ISBN for otherwise unrelated works.)

A curl request for the above, then, would read as follows:

$ curl -G --data-urlencode 'query={"type":"\/type\/edition", "isbn_10":"0789312239"}' \

Pattern matching

The API supports querying for objects based of string matching.

Here is an example to get all object with key starting from /about/.

Due to performance reasons, * is allowed only at the end of a string.

The Sort Directive

The sort directive can be used to tell Infogami to sort the results of a query before returning.

The following query gives the list of all documents sorted in the order of their keys.

By default sort operation returns the results in the ascending order. To reverse that order, prepend minus (-) to the value of sort directive.

Limiting Queries

By default every results of every query are limited to 100 values. Alternate limit can be specified by using the limit directive.

Here is an example to get first 10 templates.

The offset directive can be used to ask infogami to give results from a specific offset.

The following query gives the next 10 templates.

Expression AND in queries

All the keys in the query other than special directives (sort, limit, offset) are implicitly ANDed.

For example, the following query finds all objects having type as /type/edition and author as Mark Twain (/a/OL18319A).


Getting an Object (/get)

In Infogami, every object is identified by a unique key. In the example above, we queried the database on an ISBN and were returned the unique key for the edition that matches that ISBN. We can then retrieve the edition with a get command:

$ curl

This returns:

{ "status": "ok", "result": { "subject_place": [ "Venice (Italy)"], "lc_classifications": [ "DG674.2 .S3 2005" ], "latest_revision": 1, "genres": [ "Juvenile literature."], "title": "This is Venice", "languages": [ { "key": "\/l\/eng" }], "subjects": [ "Venice (Italy) -- Description and travel -- Juvenile literature."], "publish_country": "nyu", "by_statement": "M. Sasek.","type": { "key": "\/type\/edition" }, "revision": 1, publishers": [ "Universe"], "last_modified": "2008-04-01T03:28:50.625462", "key": "\/b\/OL3315616M", "authors": [ { "key": "\/a\/OL1396639A" } ], "publish_places": [ "New York, NY" ], "pagination": "56 p. :", "lccn": [ "2004110229" ], "notes": "\"A children's classic\"--Cover.\nOriginally published: New York : Macmillan, 1961.", "number_of_pages": 56, "isbn_10": [ "0789312239" ], publish_date": "2005" }}

Because this string is hard to read, you may want to add the parameter "prettyprint=true" when you are testing your queries.

$ curl

This returns a more eye-readable version of the same string.

# response
       "status": "ok",
        "result": {
            "Venice (Italy)",
            "DG674.2 .S3 2005",
        "latest_revision": 1,
        "genres": [
            "Juvenile literature."
        "title": "This is Venice",
        "languages": [
                "key": "\/l\/eng"
        "subjects": [
            "Venice (Italy) -- Description and travel -- Juvenile literature."
        "publish_country": "nyu",
        "by_statement": "M. Sasek.",
        "type": {
            "key": "\/type\/edition"
        "revision": 1,
        "publishers": [
        "last_modified": "2008-04-01T03:28:50.625462",
        "key": "\/b\/OL3315616M",
        "authors": [
                "key": "\/a\/OL1396639A"
        "publish_places": [
            "New York, NY"
        "pagination": "56 p. :",
        "lccn": [
        "notes": "\"A children's classic\"--Cover.\nOriginally published: New York : Macmillan, 1961.",
        "number_of_pages": 56,
        "isbn_10": [
        "publish_date": "2005"

The following example gets the page /pagelist using the API.

    $ curl
        "status": "ok",
        "result": {
            "body": "{{PageList(\"\/\")}}",
            "title": "Page List",
            "last_modified": "2008-04-18T09:19:56.978194",
            "latest_revision": 1,
            "key": "\/pagelist",
            "type": {"key": "\/type\/page"},
            "revision": 1

Since the response is in JSON format, the Content-Type is set to application/json, which may not be displayed by the browsers as text. To enable that text=true must be passed in the query string.


Queries for Versions (/versions)

In Infogami, modification of every object creates a new version of that object.
To find versions matching a particular query, send a GET request to with query as parameter. The query must be a JSON dictionary, just like the things query. The sort and limit directives work similar to the things query.

For example the following query finds the most 10 versions of / object.

# Query
        "key": "/",
        "limit": 3,
        "sort": "-created"

# Response
{ "status": "ok", "result": [ { "comment": "", "created": "2008-04-18T15:40:04.279578", "ip": "", "author": "/user/webchick", "thing_id": 9875590, "key": "/", "id": 9894268, "machine_comment": null, "revision": 14 }, { "comment": "", "created": "2008-04-18T15:39:30.588136", "ip": "", "author": "/user/webchick", "thing_id": 9875590, "key": "/", "id": 9894267, "machine_comment": null, "revision": 13 }, { "comment": "", "created": "2008-04-16T00:18:32.743829", "ip": "", "author": "/user/webchick", "thing_id": 9875590, "key": "/", "id": 9894257, "machine_comment": null, "revision": 12 } ] }


Search queries (/search)

This search API is deprecated and not maintained now. The Open Library Books API can be used for searching for ISBNs or other identifiers. We are working on a new work search API to replace this.

There is an incomplete search API as the final interface has not been decided. Only rudimentary search functions are supported for now. Development in progress is being discussed in the Open Library bug tracker at; interested parties are invited to post comments and requests in that tracker item.

A search API query is a JSON dictionary passed as the "q" http parameter. The dictionary just one meaningful entry, "query". The response is a json object containing a list of openlibrary id's. The optional argument "prettyprint" http parameter controls formatting of the response, as above. In the example below, the query is{"query":"Felix Klein"}&prettyprint=true

# Query
        "query": "Felix Klein",

# Response
"status": "ok", "result": [ "/b/OL1618362M", "/b/OL3253308M", "/b/OL2532653M", "/b/OL2628261M", "/b/OL5501881M", "/b/OL1299055M", "/b/OL2099784M", "/b/OL2418293M", "/b/OL3303109M", "/b/OL4412463M", "/b/OL5068782M", "/b/OL5305191M", "/b/OL5550601M", "/b/OL5550830M", "/b/OL5550831M", "/b/OL5876614M",


Performance Issues

To have a bound on the amount of resources consumed by a query, the runtime of each query is limited to 60 sec. Any query that takes longer is aborted.


March 2, 2022 Edited by jachamp Remove reference to missing red arrow image
September 2, 2010 Edited by Anand Chitipothu layout fixes
September 2, 2010 Edited by Anand Chitipothu copy
September 2, 2010 Edited by Anand Chitipothu fixed formatting and changed type of page from /type/doc to /type/page.
May 21, 2009 Created by Anand Chitipothu JSON API