Keep only selected pages from a PDF. MCP tool extract_pages / HTTP POST /v1/pages/extract.
Produce a new PDF containing only the pages you select, dropping the rest.
At a glance
Section titled “At a glance”| MCP tool | extract_pages |
| HTTP endpoint | POST /v1/pages/extract |
| Price | $0.05 |
| Input | One PDF + a page range |
| Output | A PDF with only the selected pages |
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | yes | Source PDF. |
pages |
page range | yes | Pages to keep, e.g. 1-3,5,9-. 1-indexed. |
MCP example
Section titled “MCP example”From
https://example.com/report.pdf, keep only pages 1 to 3 and page 5.
{ "file": "https://example.com/report.pdf", "pages": "1-3,5"}HTTP example
Section titled “HTTP example”curl -i -X POST https://api.pdfasyougo.com/v1/pages/extract \ -H "Content-Type: application/json" \ -H "X-PAYMENT: <base64-encoded-payment-payload>" \ -d '{"file":"https://example.com/report.pdf","pages":"1-3,5"}'import { wrapFetchWithPayment } from 'x402-fetch';import { privateKeyToAccount } from 'viem/accounts';
const account = privateKeyToAccount(process.env.X402_WALLET_PRIVATE_KEY as `0x${string}`);const fetchWithPay = wrapFetchWithPayment(fetch, account);
const res = await fetchWithPay('https://api.pdfasyougo.com/v1/pages/extract', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ file: 'https://example.com/report.pdf', pages: '1-3,5' }),});console.log((await res.json()).output.url);Response
Section titled “Response”{ "output": { "url": "https://files.pdfasyougo.com/o/7b2c…?token=…", "expires_at": "2026-06-29T12:00:00Z", "pages": 4, "bytes": 41984 }, "operation": "pages.extract", "cost": "0.05 USDC"}- Pages are 1-indexed; see the full page-range syntax.
- Output pages appear in ascending document order, regardless of how you ordered the terms.
- A range entirely outside the document is a
processing_errorand isn’t charged; partial overlaps are clamped.