ANYFREEBOOK

API reference

ANYFREEBOOK API v1

Base URL https://anyfreebook.com/api/v1. Every response is JSON. Errors carry a stable error field.

← Back to the overview

Try it

No key needed for the first try — the anonymous tier allows 30 requests a minute. The same call from a terminal is a single curl:

curl "https://anyfreebook.com/api/v1/search?q=free%20textbooks&limit=3"

Sources

Twelve live upstreams behind one query. This table is rendered from the same registry the API serves at /api/v1/sources, so it cannot drift away from the code.

SourceWhat it holdsTierFile
Project Gutenberg

gutenberg

The largest library of public-domain ebooks. Every ebook has a plain-text, EPUB and HTML edition, so a title matched here is a file you can download right now.79,666 ebooksdownloadyes
Internet Archive

archive

Over 5.7 million scanned books. Most are downloadable; a large lending collection is borrow-only, and the tier says which.5,757,717 scanned booksdownloadyes
Open Library

openlibrary

The catalogue layer: what exists, and which edition of it is free. It is the best place to check a title before you search for a copy.Tens of millions of worksunverifiedno
Google Books

googlebooks

A catalogue of books, some of them free to read. A record here is not a confirmed download, so the tier stays unverified.unverifiedno
LibriVox

librivox

Public-domain books read by volunteers, as free chapter files. Not included in a website search — an audiobook is rarely what someone typing a book title wants.downloadyes
PubMed Central

pubmed

The open-access subset of the biomedical literature, free as PDF.8,331,584 open-access articlesdownloadyes
DOAJ

doaj

The Directory of Open Access Journals: peer-reviewed journals that are free to read and download.13,842,528 articlesdownloadyes
OpenAlex

openalex

An index of scholarly works and their open-access copies. Only works marked open access are returned, so a paywalled paper never appears as free.250 million works; 1,248,862 open accessdownloadyes
Zenodo

zenodo

The CERN research repository. A record carries its licence and a direct file, so the tier can be stated rather than guessed.Tens of millions of open outputsdownloadyes
Wikisource

wikisource

Public-domain texts in every language that has an edition. Each page renders to a PDF, and language categories on the site search the edition for their own language.downloadyes
Europeana

europeana

The European Union aggregator of museums, archives and university libraries. Only openly licensed records are returned.downloadno
Open Textbook Library

otl

Peer-reviewed open textbooks, with the licence, the publisher and the formats stated on the record.2,039 textbooksdownloadyes

GET /search

Searches every open source at once and returns a legal tier for each result.

ParameterTypeRequiredNotes
qstringyesThe search query. Max 200 characters.
pageintegernoDefaults to 1.
sourcestringnoall (default), local, gutenberg, openlibrary, archive, googlebooks, pubmed, doaj, librivox, openalex, wikisource, europeana, zenodo, otl.
limitintegerno1–50, defaults to 20.
{
  "query": "python",
  "page": 1,
  "limit": 2,
  "total": 23872467,
  "count": 2,
  "sources": {
    "ANYFREEBOOK": 3,
    "Open Library": 6588,
    "Internet Archive": 23527856,
    "DOAJ": 17392,
    "PubMed Central": 297904,
    "Project Gutenberg": 22537,
    "LibriVox": 0,
    "Google Books": 190
  },
  "failedSources": [],
  "partial": false,
  "results": [
    {
      "id": "ol-OL2784125W",
      "title": "Learning Python",
      "author": "Mark Lutz, David Ascher",
      "year": 1999,
      "source": "Open Library",
      "sourceType": "openlibrary",
      "sourceUrl": "https://openlibrary.org/works/OL2784125W",
      "tier": "borrow",
      "tierReason": "A real Internet Archive copy exists, but it is borrow-only: a free Internet Archive account and a loan are required, so it is not a direct download.",
      "license": "Borrow-only lending copy (Internet Archive)",
      "files": [],
      "links": [
        { "label": "Read on Open Library", "url": "https://openlibrary.org/works/OL2784125W", "source": "Open Library" },
        { "label": "Read on Internet Archive", "url": "https://archive.org/details/einfuhrunginpyth0000lutz", "source": "Internet Archive" }
      ],
      "url": "https://anyfreebook.com/book/learning-python-ol-OL2784125W"
    }
  ],
  "meta": { "apiVersion": "v1", "generatedAt": "2026-10-24T11:45:48.554Z" }
}

failedSources lists the sources that did not answer, and partial is true when it is non-empty. A partial result set is not an empty result set — surface it rather than presenting a short list as everything.

GET /resolve

The authoritative answer for one title. It checks the title and the author against the real record, so a book by one Austen never resolves to a different book that shares the surname — and a request for one title never comes back with a different book attached. When nothing matches, the tier is unverified and the links point at real search pages for that exact title and author.

ParameterTypeRequiredNotes
titlestringyesThe title to resolve. Max 300 characters.
authorstringnoUsed to confirm the match.
{
  "title": "Fairy Circles",
  "author": "Villamaria",
  "tier": "download",
  "tierReason": "Open-access copy on the Internet Archive.",
  "sourceType": "archive",
  "sourceUrl": "https://archive.org/details/fairycirclestale00villiala",
  "license": "Public domain",
  "files": [
    { "format": "epub", "url": "https://archive.org/download/fairycirclestale00villiala/fairycirclestale00villiala.epub", "bytes": 15512987, "label": "fairycirclestale00villiala.epub" },
    { "format": "pdf", "url": "https://archive.org/download/fairycirclestale00villiala/fairycirclestale00villiala.pdf", "bytes": 13373257, "label": "fairycirclestale00villiala.pdf" },
    { "format": "txt", "url": "https://archive.org/download/fairycirclestale00villiala/fairycirclestale00villiala_djvu.txt", "bytes": 514307, "label": "fairycirclestale00villiala_djvu.txt" },
    { "format": "html", "url": "https://archive.org/download/fairycirclestale00villiala/fairycirclestale00villiala_hocr.html", "bytes": 11537829, "label": "fairycirclestale00villiala_hocr.html" }
  ],
  "links": [
    { "label": "Read on Internet Archive", "url": "https://archive.org/details/fairycirclestale00villiala", "source": "Internet Archive" },
    { "label": "View on Open Library", "url": "https://openlibrary.org/works/OL7903107W", "source": "Open Library" }
  ],
  "meta": { "apiVersion": "v1", "generatedAt": "2026-10-24T12:53:48.857Z" }
}

A tier of download means the copy is free to read without payment or an account. It does not guarantee a fetchable file: a DOAJ article or a PubMed Central paper is free, but the source exposes no file you can get in one request, so files is empty and the links point at the publisher’s page. Check files.length before you try to fetch.

GET /health

Liveness and version. It touches no upstream, so it stays up even when a source is down.

{ "status": "ok", "apiVersion": "v1", "uptimeSeconds": 1234 }

Authentication

Optional. The anonymous tier works with no setup. A key is sent as a bearer token: Authorization: Bearer afb_.... A key that cannot be verified gets 401 — it is never silently downgraded to the anonymous tier.

TierRequests / minuteRequests / day
anonymous (no key)30200
free602,000
partner30050,000

Errors

StatusMeaning
400Missing or invalid parameter.
401The presented API key could not be verified.
429Rate limit exceeded. The Retry-After header says how long to wait.
500Something broke on our side.

CORS

Closed by default. The allowlist comes from NEXT_PUBLIC_API_ALLOWED_ORIGINS, a comma-separated list of origins. A command-line client or a server-side SDK does not need CORS at all.