Skip to main content
The liked books API allows users to favorite books and retrieve their liked book list.

Toggle like

Add or remove a book from the user’s liked books list.
const result = await orpc.likedBooks.toggleLike.mutate({
  bookUuid: "550e8400-e29b-41d4-a716-446655440000"
});

Parameters

bookUuid
string
required
UUID of the book to like/unlike

Response

liked
boolean
Whether the book is now liked (true) or unliked (false)

Get like status

Check if a specific book is liked by the current user.
const status = await orpc.likedBooks.getLikeStatus.query({
  bookUuid: "550e8400-e29b-41d4-a716-446655440000"
});

Parameters

bookUuid
string
required
UUID of the book to check

Response

liked
boolean
Whether the book is liked by the current user

List liked books

Retrieve a paginated list of books liked by the current user.
const likedBooks = await orpc.likedBooks.listLiked.query({
  limit: 20
});

Parameters

limit
number
default:"20"
Number of books to return (max 100)

Response

Returns an array of book objects with full metadata.
books
array
Array of liked books

Implementation example

Display a like button in your book UI:
import { useState } from 'react';
import { orpc } from '@/utils/orpc';

function LikeButton({ bookUuid }: { bookUuid: string }) {
  const [liked, setLiked] = useState(false);
  
  const handleToggle = async () => {
    const result = await orpc.likedBooks.toggleLike.mutate({ bookUuid });
    setLiked(result.liked);
  };
  
  return (
    <button onClick={handleToggle}>
      {liked ? '❤️ Liked' : '🤍 Like'}
    </button>
  );
}
All liked books endpoints require authentication. The liked books list is private to each user.

Build docs developers (and LLMs) love