Helenis API
Start for free

Documents & mediaSummarization

Text Summarization API: Summarize Articles, PDFs and URLs in Python

Text summarization API tutorial: summarize articles, PDFs and web pages with Python, extract clean Markdown, and check every number against the source.

Text Summarization API cover: a newspaper sticker, an arrow and a JSON response with the title Automatic summarization, 8502 source words, 140 summary words, 35.5 minutes saved and an empty unverified_numbers list.
An 8,502-word Wikipedia page summarized in 140 words, with no number left unverified.

"Summarize this link" sounds like one prompt to a language model. In production it is three problems. The page has to be reduced to its article, without menus, cookie banners and related links. Long sources, a 40-page report or a book, have to be read in parts without losing the thread. And the summary has to be trusted: a model that rounds a figure or completes a name from memory produces a confident error that nobody checks.

This tutorial uses a text summarization API, the Article Extractor & AI Summarizer, that handles the three: it extracts the article, splits long documents, and checks every number of its own output against the source. You will summarize a Wikipedia page, an arXiv PDF and a blog post in French, extract clean Markdown for a RAG pipeline, and handle the pages that cannot be read. Every response shown comes from a real call.

Three problems behind "summarize this URL"

Problem What goes wrong What the API does
Boilerplate Navigation, ads and comments end up in the summary Extracts the main article first (trafilatura), keeps tables and headings
Length A long PDF overflows the context, or the end is silently dropped Up to 12,000 words in one pass; beyond, parts of ~10,000 words read in parallel, then summarized together
Faithfulness Rounded figures, invented names, numbers from memory Copies names and figures as written, then looks up every number of the output in the source
Unreadable pages A summary of a paywall teaser or a bot check Refuses with a clear 400, not billed

Summarization research separates extractive methods, which select sentences from the source, from abstractive ones, which write new text; quality is classically measured with ROUGE against human references. The API is abstractive (it writes), with an extractive discipline on facts (it copies them).

Extract the article from a URL (no AI)

Before summarizing, it is worth seeing what the model will read. GET /v1/summarizer/extract returns the main content of a page as text and Markdown, with its metadata, for 1 credit and no AI. The API reference documents every field.

Python
import requests

HOST = "article-extractor-ai-summarizer-url-text-pdf.p.rapidapi.com"
API = f"https://{HOST}/v1/summarizer"
HEADERS = {"x-rapidapi-key": "YOUR_API_KEY", "x-rapidapi-host": HOST}

page = "https://en.wikipedia.org/wiki/Automatic_summarization"
article = requests.get(
    f"{API}/extract", headers=HEADERS, params={"url": page}, timeout=60
).json()
print(article["title"], article["word_count"], article["reading_time_minutes"])

The real response, text and markdown cut:

JSON
{
  "url": "https://en.wikipedia.org/wiki/Automatic_summarization",
  "final_url": "https://en.wikipedia.org/wiki/Automatic_summarization",
  "title": "Automatic summarization",
  "published": "2004-05-05",
  "site_name": "Wikipedia",
  "language": "en",
  "page_type": "website",
  "text": "Automatic summarization\n\nAutomatic summarization is the process of shortening a set of data computationally, to create a subset (a summary) that represents the most important or relevant information within the original content. ...\n\nText summarization is usually implemented by natural language processing methods, designed to locate the most informative sentences in a given document. On the other hand, visual content can be summarized using computer vision algorithms. ...",
  "markdown": "# Automatic summarization\n\n**Automatic summarization** is the process of shortening a set of data computationally, ...",
  "word_count": 8502,
  "reading_time_minutes": 35.7,
  "truncated": false
}

The Markdown keeps headings, lists and tables, which makes it a good input for embeddings in a retrieval pipeline. Footnote markers such as Wikipedia's [1] are removed from both text and markdown, so they do not leak into embeddings or summaries, and site_name comes from the page's og:site_name. published also comes from the page's own metadata: for Wikipedia, the date the article was created. On news sites the response also carries byline, description and the lead image.

Summarize a URL with Python

POST /v1/summarizer/summarize takes a url (a web page, or a direct link to a PDF, DOCX, TXT, Markdown or HTML file) or a text, plus options. A short summary of the same 8,502-word page:

Python
summary = requests.post(
    f"{API}/summarize",
    headers=HEADERS,
    json={"url": page, "length": "short"},
    timeout=120,
).json()
print(summary["tldr"])
for point in summary["key_points"]:
    print("-", point)

The real response:

JSON
{
  "title": "Automatic summarization",
  "summary": "Automatic summarization is the computational process of shortening data to create a representative subset. It employs extraction, which selects existing content, or abstraction, which generates new text. Techniques include supervised learning and unsupervised graph-based methods like TextRank. Applications span text, images, and video, with recent advancements focusing on transformer models and submodular functions for improved quality and diversity.",
  "key_points": [
    "Automatic summarization uses extractive methods to select existing content or abstractive methods to generate new, paraphrased information.",
    "Graph-based algorithms like TextRank and LexRank, along with submodular functions, are widely used to model coverage, diversity, and relevance in summaries.",
    "Evaluation of summarization systems typically relies on comparing machine-generated output against human-created references using metrics like ROUGE."
  ],
  "tldr": "Automatic summarization uses computational algorithms to condense data into representative subsets through extraction or abstraction, with applications across text, image, and video domains.",
  "language": "en",
  "output_language": "English",
  "source_words": 8502,
  "summary_words": 140,
  "reading_time": { "source_minutes": 35.7, "summary_minutes": 0.2, "saved_minutes": 35.5 },
  "chunks": 1,
  "unverified_numbers": [],
  "source": { "type": "url", "file_type": "html", "name": "https://en.wikipedia.org/wiki/Automatic_summarization" },
  "article": {
    "url": "https://en.wikipedia.org/wiki/Automatic_summarization",
    "final_url": "https://en.wikipedia.org/wiki/Automatic_summarization",
    "title": "Automatic summarization",
    "published": "2004-05-05",
    "site_name": "Wikipedia",
    "language": "en",
    "page_type": "website"
  },
  "notices": [],
  "credits": 60
}

The call took 3.8 seconds. It used 60 credits because credits follow the source's length: 20 up to 2,000 words, then 10 per started 2,000 words, and 8,502 words is four more slices. A typical news article of 600 to 1,500 words costs 20.

Summarize a PDF with a focus

A direct link to a PDF works the same way; its text layer is read. focus takes a topic of up to 200 characters that gets more room in the summary. The arXiv paper that introduced the Transformer, with a focus on training cost:

Python
paper = requests.post(
    f"{API}/summarize",
    headers=HEADERS,
    json={
        "url": "https://arxiv.org/pdf/1706.03762",
        "length": "short",
        "focus": "training cost and hardware",
    },
    timeout=120,
).json()

The real response, shortened:

JSON
{
  "title": "Attention Is All You Need",
  "key_points": [
    "The Transformer model replaces recurrent and convolutional layers with multi-headed self-attention, enabling superior parallelization and faster training.",
    "The model achieved a new state-of-the-art BLEU score of 28.4 on the WMT 2014 English-to-German task after 3.5 days of training on eight P100 GPUs.",
    "The Transformer demonstrates strong generalization capabilities, performing well on English constituency parsing tasks despite minimal task-specific tuning."
  ],
  "tldr": "The Transformer is a novel, highly parallelizable sequence transduction model based entirely on attention that achieves state-of-the-art translation quality with significantly reduced training costs.",
  "source_words": 6460,
  "summary_words": 160,
  "chunks": 1,
  "unverified_numbers": [],
  "source": { "type": "url", "file_type": "pdf", "name": "https://arxiv.org/pdf/1706.03762", "pages": 15 },
  "credits": 50
}

The figures, 28.4 BLEU, 3.5 days and eight P100 GPUs, all appear in the paper (the BLEU score in its abstract, the hardware and training time in its training section), and unverified_numbers is empty: every number was found in the source. Scanned PDFs have no text layer and get 400 scanned_pdf; run them through an OCR first, as shown in the PDF to text walkthrough. Local files go to POST /v1/summarizer/summarize/upload as multipart/form-data:

Terminal
curl -X POST "https://article-extractor-ai-summarizer-url-text-pdf.p.rapidapi.com/v1/summarizer/summarize/upload" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: article-extractor-ai-summarizer-url-text-pdf.p.rapidapi.com" \
  -F "file=@annual-report.pdf" -F "length=long" -F "focus=risks and outlook"

Length, format and output language

Option Values Effect
length short, medium (default), long About 60 words and 3 points, 150 and 5, 350 and 8; never more than a third of the source
sentences 1 to 20 An exact number of sentences instead of a length
format all (default), paragraph, bullets, key_points, tldr Only the parts you ask for are written
language ISO code or English name (fr, pt-br, Japanese...) Output language; the source's by default
focus A topic, 200 characters More room for that topic, nothing invented about it

A real call on a Paul Graham essay in English, with "format": "bullets", "language": "fr" and "length": "short", shortened:

JSON
{
  "title": "Putting Ideas into Words",
  "summary": "- L'écriture constitue un test rigoureux qui révèle que les idées sont souvent imprécises ou incomplètes avant d'être formulées.\n- La relecture critique, en adoptant le point de vue d'un lecteur étranger, est essentielle pour affiner et compléter sa pensée.\n- L'écriture est un processus nécessaire pour transformer des connaissances inconscientes en idées pleinement formées et structurées.",
  "key_points": [],
  "tldr": "Mettre ses idées par écrit est un exercice indispensable pour clarifier sa pensée, car ce processus révèle les lacunes et les imprécisions inhérentes aux concepts non formulés.",
  "language": "en",
  "output_language": "French",
  "source_words": 1210,
  "summary_words": 85,
  "credits": 20
}

language still says the source was English; output_language says what was written. In bullets format the summary is Markdown bullet lines, ready for a newsletter or a Slack message. focus is a topic, not a prompt: there is no field to send instructions, and text in a page that tells "the AI" what to do is summarized as content.

Long documents: reading in parallel parts

Up to 12,000 words, the source is summarized in one pass. Beyond, it is cut between paragraphs into parts of about 10,000 words, all parts are read at the same time, and a final pass writes the summary from their notes; chunks says how many parts were used. Sources up to 100,000 words are accepted, about a novel: in the product's tests, The War of the Worlds (61,031 words) took 22 seconds and the IPCC synthesis report (22,573 words, 40 PDF pages) 18 to 58 seconds, most of it reading the PDF.

Check the numbers before you publish

Every number in the summary, key points and TL;DR is looked up in the source, ignoring separators and trailing zeros ("1.2 million" matches "1,200,000"). Numbers that cannot be found are listed in unverified_numbers. Use it as a gate in an automated pipeline:

Python
def safe_to_publish(result: dict) -> bool:
    """Hold back summaries with figures that are not in the source."""
    if result["unverified_numbers"]:
        print("check by hand:", result["unverified_numbers"])
        return False
    return True

In the product's battery of 41 real pages in 7 languages, no number was flagged on the 30 summaries produced. A flag is not always an error: a percentage the summary computes from two figures of the source is flagged too, which is the point, since someone should look at it.

Errors to handle

Pages that cannot be read answer 400 and are not billed. A real call on the technology section of The New York Times:

JSON
{
  "error": {
    "status": 400,
    "code": "site_blocked",
    "message": "The website refused automated access (HTTP 403)."
  }
}
Code Meaning What to do
page_paywalled Only a subscriber teaser is readable Send the article's text in text
page_blocked A bot check or "JavaScript required" page Send the text, or skip
page_empty No readable article (JavaScript-only page) Send the text
site_blocked / site_unreachable The site refused (403) or did not answer Retry later, or send the text
scanned_pdf No text layer OCR it first
text_too_short / input_too_long Under 25 words, over 100,000 Skip, or split
ai_error / upstream_timeout (503) The AI did not answer in time Retry with backoff

For feeds of articles, pair this with a news source: the News API briefing tutorial gets headlines, and the podcast API guide does the same for episodes.

What it costs

Plan Price per month Credits Summaries (up to 2,000 words) Extractions
BASIC Free 40 per day 2 per day 40 per day
PRO $4.99 16,000 800 ($0.0062 each) 16,000 ($0.0003 each)
ULTRA $14.99 48,000 2,400 48,000
MEGA $49.99 160,000 8,000 160,000

A summary uses 20 credits up to 2,000 words, 10 more per started 2,000 words, and 10 more with long. The free plan reads up to 2,000 words per call. Beyond the quota, paid plans continue at $0.0035 per credit. For comparison, the most-subscribed article summarizer on RapidAPI charges $0.03 a summary and answered 16% of its calls successfully on 27 Nov 2026.

What the text summarization API does not do

  • No JavaScript rendering, logins or paywalls. Such pages are refused, not guessed; send their text.
  • No OCR. Scanned PDFs and images need a text layer first.
  • No free prompt. It summarizes; it does not answer questions, rewrite in a style or follow instructions.
  • No fact-checking of the source. It is faithful to the source, right or wrong.
  • No storage. Texts, pages and files are not kept; send them again to summarize them again.
  • Bylines and dates depend on the page. They come from its metadata, and some sites publish none.

Frequently asked questions

What is the best API to summarize text?

One that is faithful to the source and fails clearly. Look for the number check (unverified_numbers here), handling of long documents, and honest errors on paywalls instead of a summary of a login page.

How do I summarize a PDF with an API?

Send a direct link to the PDF in url, or upload the file to /v1/summarizer/summarize/upload. PDFs with a text layer work up to 100,000 words; scanned PDFs need OCR first.

Can I summarize a web page by URL?

Yes. The main article is extracted first, then summarized, and the response includes the article's title, site, date and byline when the page publishes them.

How long can the text be?

Up to 100,000 words per call; 50,000 characters in a JSON text field, more through the upload endpoint. Credits grow with the length.

Which languages are supported?

The source can be in any language and is detected automatically. The summary is written in the source's language by default, or in any of 50+ languages set with language.

Is there a free text summarization API?

The BASIC plan is free: 40 credits a day, enough for 2 summaries of up to 2,000 words or 40 article extractions.

Get started

Article Extractor & AI Summarizer API

Summarize URLs, PDFs and text: summary, key points and TL;DR in any language; article extractor.

  • Summarization
  • NLP
  • LLM
  • Python
  • RAG