Summarize a PDF

$0.03 per callUSDC via x402POST /api/pdf-summarize

Fetch a PDF from a URL, extract its text, and return a concise AI-generated summary - factual, no information added beyond what's in the document. Send POST /api/pdf-summarize with the required field url and pay $0.03 per call over x402 or MPP (there is no free tier). It returns a JSON object with url, pages, wordCount, summary, summaryWordCount and 2 more.

Body: {"url":"https://…/file.pdf","maxWords":200?}. Uses the same OpenAI-compatible gateway as /v1/chat/completions internally; the model that actually served is disclosed in the response.

Category: Web & documentsTags: pdf summarize summary documents ai text-extraction

Try in playground →

Parameters

NameTypeRequiredDescription
urlstringyesPublic http(s) URL of a PDF Also accepted as link, uri, href, page.
maxWordsnumbernoTarget summary length in words, 50-500 (default 200)

Example request

curl -i -X POST https://agent402.tools/api/pdf-summarize \
  -H "Content-Type: application/json" \
  -d '{"url":"https://agent402.tools/fixtures/sample-report.pdf","maxWords":150}'

Without payment this returns HTTP 402 Payment Required with the exact price for pdf-summarize; any x402 v2 or MPP client pays it and retries.

Example response

{
  "url": "https://agent402.tools/fixtures/sample-report.pdf",
  "pages": 3,
  "wordCount": 247,
  "summary": "The document outlines a system for agents to purchase single answers from a tool server. Agents can request information, receive a price, and then pay for the answer by signing a payment for that exact amount. Payment is processed only after the tool successfully completes its operation; if the tool fails, no x402 charge is applied…",
  "summaryWordCount": 112,
  "model": "openai/gpt-4o-mini",
  "truncatedInput": false
}
FieldTypeAlways presentIn the example
urlstringyeshttps://agent402.tools/fixtures/sample-report.pdf
pagesnumberyes3
wordCountnumberyes247
summarystringyesThe document outlines a system for agents to purchase single answers from a t...
summaryWordCountnumberyes112
modelstringyesopenai/gpt-4o-mini
truncatedInputbooleanyesfalse

From an MCP client

catalog.call {
  "slug": "pdf-summarize",
  "params": {
    "url": "https://agent402.tools/fixtures/sample-report.pdf",
    "maxWords": 150
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for pdf-summarize; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.13.31.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.03" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/pdf-summarize", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "https://agent402.tools/fixtures/sample-report.pdf",
    "maxWords": 150
  }),
});

Part of these workflows

Summarize a PDF is one step in this skill pack, each sold as a single call:

Related tools

PDF to text

$0.01 · POST /api/pdf

Fetch a PDF from a URL and extract its text content.

Images to PDF

$0.004 · POST /api/images-to-pdf

Combine PNG/JPEG images into a single PDF, one image per page.

Extract / split PDF pages

$0.003 · POST /api/pdf-extract-pages

Pull a subset of pages into a new PDF (split).

PDF info

$0.001 · POST /api/pdf-info

Inspect a PDF without downloading the whole thing into your model: page count, title, author, subject, creator.

Merge PDFs

$0.004 · POST /api/pdf-merge

Combine several PDFs into one, in order.

Rotate PDF

$0.003 · POST /api/pdf-rotate

Rotate pages by 90/180/270°.