Combine multiple PDFs into a single document. MCP tool merge_pdfs / HTTP POST /v1/merge.
Combine multiple PDFs into one, in the order you provide them.
At a glance
Section titled “At a glance”| MCP tool | merge_pdfs |
| HTTP endpoint | POST /v1/merge |
| Price | $0.05 |
| Input | An ordered list of PDFs |
| Output | A single merged PDF (download URL) |
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
files |
array of files | yes | Two or more source PDFs, merged in array order. Each item may be a URL, an upload, or (small) base64. |
MCP example
Section titled “MCP example”Merge
https://example.com/q3-part1.pdfandhttps://example.com/q3-part2.pdfinto one file.
The agent calls merge_pdfs with:
{ "files": [ "https://example.com/q3-part1.pdf", "https://example.com/q3-part2.pdf" ]}HTTP example
Section titled “HTTP example”# 1) Unpaid request → 402 with payment requirementscurl -i -X POST https://api.pdfasyougo.com/v1/merge \ -H "Content-Type: application/json" \ -d '{"files":["https://example.com/q3-part1.pdf","https://example.com/q3-part2.pdf"]}'
# 2) Retry with a signed payment payloadcurl -i -X POST https://api.pdfasyougo.com/v1/merge \ -H "Content-Type: application/json" \ -H "X-PAYMENT: <base64-encoded-payment-payload>" \ -d '{"files":["https://example.com/q3-part1.pdf","https://example.com/q3-part2.pdf"]}'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/merge', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ files: [ 'https://example.com/q3-part1.pdf', 'https://example.com/q3-part2.pdf', ], }),});console.log((await res.json()).output.url);Response
Section titled “Response”{ "output": { "url": "https://files.pdfasyougo.com/o/3f9a…?token=…", "expires_at": "2026-06-29T12:00:00Z", "pages": 24, "bytes": 184320 }, "operation": "merge", "cost": "0.05 USDC"}- Order is preserved — files are concatenated in the order of the
filesarray. - You can mix input forms in one call (e.g. one URL and one upload). See File handling.
- Provide at least two files; a single file returns a
validation_error.