Skip to content

Widgets

Public widget feed

You can show a small selection of Readino books in your application or website without implementing sign-in, shelves, or purchases. Use the public widget feed and link each cover to the book's Readino web page.

https://readino.com/api/v2/opds2/books-for-widget?limit=8&country=GB&widget_id=my-app-home

The endpoint returns application/opds+json with a publications array. Within each publication's links array, find a link whose rel includes alternate and whose type is text/html; its href is the book's Readino web page. This is the destination when the user clicks the widget item. The image URL comes separately from images.

Parameters

Query parameter Meaning
limit Number of books requested: use an integer from 1 to 12. Default: 4; the server caps larger requests at 12. The response can contain fewer books.
country Uppercase two-letter country code for availability and prices. GB, US, and AU are supported; other values fall back to GB. If omitted, the server uses request-country detection.
widget_id Stable sampling seed for your widget or placement, such as my-app-home. Default: widget. It is not an authentication credential.

The selection mixes books from several curated categories and changes over time; the book ordering rotates every twelve hours, with category ordering changing daily. This is a small selection feed, with no pagination or catalogue export facility.

JavaScript example

No authentication is needed. For a browser widget, omit cookies and bearer tokens; the endpoint supports cross-origin requests with Access-Control-Allow-Origin: *:

const response = await fetch(
  "https://readino.com/api/v2/opds2/books-for-widget?limit=8&country=GB&widget_id=my-app-home",
  { headers: { Accept: "application/opds+json" }, credentials: "omit" }
);
if (!response.ok) throw new Error("Readino widget feed is unavailable");
const { publications = [] } = await response.json();
const hasRel = (link, rel) =>
  (Array.isArray(link.rel) ? link.rel : [link.rel]).includes(rel);
const supportedImages = new Set(["image/jpeg", "image/png", "image/webp"]);
const coverWidth = 160; // Target width in pixels for this widget.

const items = publications.flatMap(publication => {
  const page = (publication.links ?? []).find(link =>
    hasRel(link, "alternate") && link.type === "text/html"
  );
  const covers = (publication.images ?? []).filter(image =>
    image.href && supportedImages.has(image.type)
  );
  const sized = covers.filter(image => Number.isFinite(image.width) && image.width > 0)
    .sort((a, b) => a.width - b.width);
  const cover = sized.find(image => image.width >= coverWidth)
    ?? sized[sized.length - 1] ?? covers[0];
  if (!page?.href || !cover) return [];
  return [{
    title: publication.metadata.title,
    pageUrl: new URL(page.href, response.url).href,
    coverUrl: new URL(cover.href, response.url).href
  }];
});
// Render each coverUrl as an image inside a link to pageUrl.

Adjust the supported image types and target width for your client. Other publication fields, including authors and buy-link prices, can also be used in the widget. This display-only use does not require implementing checkout.