Text Summarizer API

Summarise Vietnamese or English articles by picking their most important sentences (TextRank), with keywords and scores; fast, deterministic and without AI costs.

POSThttps://apibox.io.vn/v1/summarize

The summarize API produces an extractive summary: it splits the text into sentences, represents each one by its words (Vietnamese words are segmented first, so “ngân hàng” counts as one word), builds a similarity graph between sentences with TF-IDF weights and ranks them with TextRank, the algorithm behind PageRank. The best sentences (or a ratio of the text) are returned in their original order, with their scores, the main keywords and the compression ratio.

Because sentences are copied from the text, the summary never invents facts, and the same text always gives the same summary. Abbreviations such as “TP.” and decimals are handled when splitting sentences, and the language is detected automatically (or set with lang).

Extractive summaries work best on news, reports and documentation. For rewritten, abstractive summaries an AI model is needed; this API deliberately avoids them to stay fast and cheap.

Parameters

NameInTypeRequiredDefault
textbodystringyesThe text (max 200,000 characters).
sentencesbodynumbernoNumber of sentences (1–50; default about 25%, max 5).
ratiobodynumbernoShare of sentences to keep (0.05–0.9), instead of sentences.
langbodystringnovi or en (default: detected).

Example

curl -X POST "https://apibox.io.vn/v1/summarize" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Ngân hàng Nhà nước vừa công bố giảm lãi suất điều hành thêm 0,5 điểm phần trăm… (8 câu)","sentences":3}'

Response

{
  "lang": "vi",
  "sentences_total": 8,
  "sentences_selected": 3,
  "summary": "Ngân hàng Nhà nước vừa công bố giảm lãi suất điều hành thêm 0,5 điểm phần trăm, áp dụng từ ngày 15/11. Các ngân hàng thương mại dự kiến sẽ giảm lãi suất cho vay trong tháng tới. Ngân hàng Nhà nước cho biết sẽ theo dõi chặt chẽ diễn biến thị trường để điều hành linh hoạt.",
  "sentences": [
    "…"
  ],
  "keywords": [
    "ngân hàng",
    "lãi suất",
    "…"
  ],
  "compression": 0.4,
  "method": "Extractive (TextRank over TF-IDF sentence similarity); …"
}

Use cases

  • News digests and article previews
  • Summaries of long support tickets or reports
  • Meta descriptions from article bodies
  • Pre-reading of documents in internal tools

FAQ

Is this AI?

No large language model is used: TextRank is a graph algorithm. Results are deterministic and cost the same as any other request.

How long should the text be?

From a few paragraphs; with fewer than 3 sentences the text itself is returned.

Does it work for Vietnamese?

Yes, with Vietnamese word segmentation and stop words.

Related APIs

Start with 1,000 free requests every month. Get free API key →