Skip to content

Lists

Last Updated   August 3, 2025

Reference

What Is a List?

Lists in Hardcover are user-created collections of books organized around themes, genres, or personal preferences. Users can create public or private lists to organize and share their reading recommendations with the community.

Queries

Available List Queries

QueryReturnsDescription
listslists[]Fetch an array of lists with filtering and pagination
lists_aggregatelists_aggregateGet aggregated data about lists (count, averages, etc.)
lists_by_pklistsFetch a single list by its primary key (id)
list_bookslist_books[]Fetch books in lists with filtering options
list_books_aggregatelist_books_aggregateGet aggregated data about books in lists
list_books_by_pklist_booksFetch a single list book entry by its id
followed_listsfollowed_lists[]Fetch lists followed by users
followed_lists_by_pkfollowed_listsFetch a single followed list entry by id

List Schema Fields

FieldTypeDescription
idintUnique identifier for the list
namestringThe title/name of the list
descriptionstringDescription of the list’s purpose or theme
slugstringURL-friendly identifier for the list
books_countintTotal number of books in the list
likes_countintNumber of users who have liked this list
publicboolWhether the list is publicly visible
privacy_setting_idintPrivacy setting for the list: 1 = public, 2 = followers only, 3 = private
user_idintID of the user who created the list
created_attimestampWhen the list was created
updated_attimestampWhen the list was last modified
userUserUser object of the list creator
list_booksListBook[]Array of books associated with this list

ListBook Schema Fields

FieldTypeDescription
idintUnique identifier for the list_book entry
list_idintID of the list containing this book
book_idintID of the book in this list
edition_idintOptional specific edition of the book
positionintOrder position of the book in the list
date_addedtimestamptzWhen the book was added to the list
bookbooksThe book object
listlistsThe list object
editioneditionsOptional edition object
  • Books - Books that can be added to lists
  • Users - Users who create and interact with lists
  • Editions - Specific editions of books

Example Queries

Get All Public Lists

Retrieve the top 10 most-liked public lists.

Public Lists
query GetPublicLists {
lists(
where: {public: {_eq: true}}
order_by: {likes_count: desc}
limit: 10
) {
id
name
description
books_count
likes_count
user {
username
}
}
}

Get Lists by a Specific User

Get all lists created by a specific user. Replace ##USER_ID## with the actual user ID.

User Lists
query GetUserLists {
lists(
where: {user_id: {_eq: ##USER_ID##}},
order_by: {updated_at: desc}
) {
id
name
description
books_count
public
created_at
updated_at
}
}

Get Books in a Specific List

Get all books in a specific list with their details.

This example uses NPR Top 100 Science Fiction Fantasy list (ID: 3).

List Books
query GetListBooks {
lists(where: {id: {_eq: 3}}) {
name
description
list_books {
book {
id
title
contributions {
author {
name
}
}
rating
pages
}
position
date_added
}
}
}

Get a Single List by ID

Fetch a specific list using its primary key.

Get List by ID
query GetListById {
lists_by_pk(id: 3) {
id
name
description
books_count
likes_count
privacy_setting_id
created_at
updated_at
user {
id
username
image_id
}
}
}

Get List Statistics

Use aggregate queries to get statistics about lists.

List Statistics
query GetListStats {
lists_aggregate(where: {public: {_eq: true}}) {
aggregate {
count
avg {
books_count
likes_count
}
max {
books_count
likes_count
}
}
}
}

Get Followed Lists

Get all lists that the authenticated user is following.

Followed Lists
query GetMyFollowedLists {
followed_lists(order_by: {created_at: desc}) {
id
created_at
list {
id
name
description
books_count
likes_count
user {
username
}
}
}
}

Get Lists by Popularity

Find public lists ordered by popularity.

Popular Lists
query GetPopularLists {
lists(
where: {public: {_eq: true}}
limit: 20
order_by: {likes_count: desc}
) {
id
name
description
books_count
likes_count
user {
username
}
}
}

Mutations

Available List Mutations

MutationReturnsDescription
insert_listListIdTypeCreate a new list
update_listListIdTypeUpdate an existing list
delete_listListDeleteTypeDelete a list (must be owner)
insert_list_bookListBookIdTypeAdd a book to a list
delete_list_bookListBookDeleteTypeRemove a book from a list
update_list_bookslist_books_mutation_responseUpdate multiple list book entries
upsert_followed_listFollowedListTypeFollow or unfollow a list
delete_followed_listDeleteListTypeUnfollow a list

Mutation Response Types

List mutations return different response types based on the operation:

ListIdType (for insert_list, update_list)

FieldTypeDescription
idIntID of the created/updated list
listlistsThe complete list object
errorsStringAny error messages

ListBookIdType (for insert_list_book)

FieldTypeDescription
idIntID of the created list_book entry
list_booklist_booksThe complete list_book object

ListDeleteType (for delete_list) and DeleteListType (for delete_followed_list)

FieldTypeDescription
successBoolean!Whether the deletion was successful

Create a New List

Create a new list with name, description, and privacy setting.

Privacy settings:

  • 1 = public
  • 2 = followers only
  • 3 = private
Create List
mutation CreateList {
insert_list(
object: {
name: "My Favorite Sci-Fi Books"
description: "A collection of the best science fiction novels I've read"
privacy_setting_id: 1
}
) {
affected_rows
returning {
id
name
description
public
created_at
user {
username
}
}
}
}

Add a Book to a List

Add a book to your own list.

Add Book to List
mutation AddBookToList {
insert_list_book(
object: {
list_id: 27818
book_id: 456
position: 1
}
) {
id
list_book {
id
list_id
book_id
position
date_added
book {
title
}
list {
name
}
}
}
}

Update a List

Update an existing list’s details.

Update List
mutation UpdateList {
update_list(
id: 27818
object: {
name: "Updated List Name"
description: "This is the updated description for my list"
privacy_setting_id: 2
}
) {
id
list {
id
name
description
privacy_setting_id
updated_at
}
}
}

Delete a List

Delete a list you own.

Delete List
mutation DeleteList {
delete_list(id: 27818) {
success
}
}

Remove a Book from a List

Remove a specific book from your list.

Remove Book from List
mutation RemoveBookFromList {
delete_list_book(id: 123456) {
id
list_id
list {
name
books_count
}
}
}

Follow/Unfollow a List

Follow a public list to track updates. This mutation acts as an upsert - it will create a follow if it doesn’t exist.

Follow List
mutation FollowList {
upsert_followed_list(list_id: 3) {
id
followed_list {
id
list_id
user_id
created_at
list {
name
user {
username
}
}
}
}
}

Unfollow a List

Remove a list from your followed lists.

Unfollow List
mutation UnfollowList {
delete_followed_list(list_id: 3) {
success
}
}