{"uid":"cap_5qdhp63hpnEcd6-7vanwm","slug":"tanod-docs-pdf-compress-10af1e6b","name":"Tanod Docs PDF Compress","description":"Documents: DOCX template fill, Office to PDF, any file to Markdown, PDF to Word, OCR, PDF pipeline.","url":"https://docs.tanod.dev/v1/pdf/compress?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1},{"type":"null"}],"default":null,"description":"Public http(s) URL of the PDF (at most 20 MB; private, internal and IP-literal hosts are refused); or use pdf_base64."},"level":{"enum":["lossless","recommended","extreme"],"type":"string","default":"recommended","description":"lossless: structure only; recommended: images JPEG q75 at most 150 dpi; extreme: q50 at most 96 dpi."},"output":{"enum":["base64","url"],"type":"string","default":"base64","description":"base64 (default): the file comes back inline as base64. url: the file is stored for 24 hours and the reply carries a download link (url, expires_at, bytes, content_type, sha256) instead of the base64, which keeps the file out of your context window."},"pdf_base64":{"anyOf":[{"type":"string","maxLength":13398872,"minLength":1},{"type":"null"}],"default":null,"description":"The PDF as base64 (at most 10 MB decoded per request); or use url."},"image_quality":{"anyOf":[{"type":"integer","maximum":95,"minimum":10},{"type":"null"}],"default":null,"description":"Override the level's JPEG quality."},"max_image_dpi":{"anyOf":[{"type":"integer","maximum":600,"minimum":50},{"type":"null"}],"default":null,"description":"Override the level's image dpi ceiling."}}},"responseSchema":{"type":"json","example":{"file":{"name":"compressed.pdf","bytes":85124,"pages":6,"data_base64":"JVBERi0xLjcKJb/3... (trimmed: 113,500 base64 characters in the reply)","content_type":"application/pdf"},"level":"extreme","images":{"images":0,"skipped":0,"recompressed":0},"method":"lossless","operation":"compress","unchanged":false,"bytes_after":85124,"input_bytes":140815,"input_pages":6,"bytes_before":140815,"output_bytes":85124,"saved_percent":39.5,"untrusted_content":true,"active_content_removed":{"xfa":1,"javascript":1}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Ww5WyGM19QxnPmz46JDwN","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compresses a PDF file using lossless, recommended, or extreme image recompression to reduce file size","exampleAgentPrompt":"Can you compress this PDF for me — use extreme compression to get the file as small as possible? Here's the URL: https://example.com/report.pdf. Give me back a download link instead of the raw file.","exampleUseCases":[{"title":"Email attachment size reduction","prompt":"I need to email this PDF report but it's 15 MB and too big to attach. Can you compress it using the recommended level and give me back the file as base64? Here's the URL: https://mysite.com/annual-report.pdf"},{"title":"Archival storage optimization","prompt":"I'm archiving thousands of PDFs and need to cut storage costs. Compress this PDF at the extreme level — max 96 DPI images and JPEG quality 50 — and return a download link so it doesn't fill up my context: https://files.example.com/invoice-2024.pdf"},{"title":"Secure PDF sanitization before sharing","prompt":"Before I share this PDF with a client I want to strip any embedded JavaScript or XFA forms and compress it at the lossless level to keep full image quality. Here's the PDF as a base64 string: [base64data]"}],"resultDescription":"Returns a JSON object with the compressed PDF either inline as base64 or as a temporary download URL valid for 24 hours, along with metadata including original and final byte sizes, pages, saved percentage, compression level used, image recompression stats, and flags for any active content (JavaScript, XFA) that was removed.","failureModes":["PDF URL exceeds 20 MB or is not publicly accessible — request refused","Base64 input exceeds 10 MB decoded — request refused","Private, internal, or IP-literal host URLs are blocked — request refused","Malformed or password-protected PDF — processing error returned","image_quality or max_image_dpi out of allowed range — validation error","Unsupported or corrupt PDF structure — pipeline failure"],"whenToPreferThis":"Choose this endpoint when you need to reduce PDF file size for storage, email, or sharing, especially when you also want automatic removal of embedded JavaScript and XFA active content as a security benefit. Prefer it over generic file conversion tools when the input is already a PDF and the goal is compression with fine-grained control over image quality and DPI. The three compression levels (lossless, recommended, extreme) and the option to receive a download URL instead of inline base64 make it suitable for both quality-sensitive archival and aggressive size reduction workflows.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-13T12:44:05.953Z","isFirstParty":false,"canonicalSlug":"tanod-docs-pdf-compress-10af1e6b"}