Chain APIs into a summarise-and-score pipeline

Give it a list of URLs and get back a title, a three-sentence summary and a sentiment score for each, from three APIs wired together with per-step errors, parallel calls and an honest credit count.

The previous projects each called one or two APIs and used the answers directly. Real features are often a chain: one call produces something, the next call consumes it, and the thing you show the user only exists at the end. The code that connects those calls is where most of the engineering lives. Which steps depend on which? What happens when the third step fails but the first two worked? How much did the whole run cost?

You will build a command-line pipeline that takes one or more URLs and, for each, extracts the page's text, summarises it, and scores its tone. It is the core of a dozen real tools: a reading-list digest, a competitor-news monitor, a review triage queue. The three APIs are almost incidental. The structure is the lesson.

The three steps and their contracts

Every link in a chain has a contract: what goes in, what comes out, and what the next step needs from it. Write those down before writing code, because the mismatches between them are where pipelines break.

Step 1: Website to Text (websitetotext). A POST with one required body field, url. It returns text (the page's body copy with the HTML stripped), plus title, description, date, language, publisher and url. The catalog lists it at 25 credits.

Try it liveWebsite to Text25 credits
POSThttps://api.apiverve.com/v1/websitetotext
curl -X POST "https://api.apiverve.com/v1/websitetotext" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/QR_code"}'
Sign in or create a free account to run this with your own key.

text is long: tens of thousands of characters for a full article. That matters for the next step.

When we ran that call, text was over 76,000 characters, and the extracted title and date were not the article's title and date. Metadata extraction is a best guess on pages that do not mark it up cleanly. The body text is the dependable output; treat the rest as optional and fall back to the URL when a title looks wrong or is missing.

Step 2: Text Summarizer (textsummarizer). A POST taking text (up to 5,000 characters) and an optional sentences count, default 3. It returns summary. The word counts and reduction percentage (originalWords, summaryWords, percentDifference) are premium. 20 credits.

Try it liveText Summarizer20 credits
POSThttps://api.apiverve.com/v1/textsummarizer
curl -X POST "https://api.apiverve.com/v1/textsummarizer" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"A QR code is a two-dimensional matrix barcode invented in 1994 by Masahiro Hara of Denso Wave for labelling automobile parts. It is read by cameras and decoded using Reed-Solomon error correction. QR codes store data in four encoding modes: numeric, alphanumeric, byte and kanji. They are used to open web pages, add contacts, join wireless networks and make payments.","sentences":2}'
Sign in or create a free account to run this with your own key.

The summary is extractive: it picks existing sentences rather than writing new ones.

The summary is extractive. It selects the sentences that carry the most weight and returns them as written, which means it never invents a claim the page did not make. It also means a sentence that starts with "It" may lose its subject. Worth knowing before you show it to users.

Step 3: Sentiment Analysis (sentimentanalysis). A POST taking text. It returns sentiment (a summed word score), comparative (that score divided by the number of words), sentimentText (a label), and the booleans isPositive and isNegative; normalizedScore is premium. 10 credits.

Try it liveSentiment Analysis10 credits
POSThttps://api.apiverve.com/v1/sentimentanalysis
curl -X POST "https://api.apiverve.com/v1/sentimentanalysis" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The package arrived late and the box was broken."}'
Sign in or create a free account to run this with your own key.

Compare sentimentText with isNegative and the numeric score.

Run that one and look closely. When we called it, sentiment was -1, isNegative was true, and sentimentText was neutral. The label is a band over the score, and a mildly negative sentence falls inside the neutral band. Neither field is wrong; they answer different questions. If your feature sorts by tone, sort by comparative, which is comparable across texts of different lengths. Use the label only for display.

The cost of one URL through the whole chain is the sum of its steps: 25 + 20 + 10 = 55 credits. Calls that fail are not billed, so a run where step 3 errors costs 45. You will make the pipeline report that number itself, rather than leaving it as arithmetic you do once and forget.

The shape of the pipeline

Draw the dependencies before you write anything:

url ──► websitetotext ──► excerpt ─┬─► textsummarizer ──► summary
                                   └─► sentimentanalysis ──► tone

Step 1 must finish before anything else can start. Steps 2 and 3 both need the excerpt, but neither needs the other, so they run at the same time. That turns the pipeline's latency from the sum of three calls into the first call plus the slower of the other two.

The excerpt step in the middle is not an API. It is your code adapting one contract to the next: the summariser takes at most 5,000 characters, and a full article can be fifteen times that. You cut the text at a sentence boundary under the limit and strip noise like citation markers. Every real pipeline has glue like this, and it deserves the same care as the calls.

Failures follow the same picture. If step 1 fails there is nothing to analyse, so that URL fails as a whole. If step 2 or 3 fails, the other's result is still useful, so you return a partial result with a clear marker rather than throwing away work you paid for.

Check yourself

Step 1 succeeds, then the summarizer times out while sentiment analysis succeeds. What should the pipeline return for that URL?

Answer the check above to continue.

Run every example on your own key. Free plan, no card.

Scaling up?

Volume pricing, custom SLAs, and dedicated support for high-traffic teams.

Contact sales