PDF.co API: extract, convert, and automate PDF workflows
PDF.co API: extract, convert, and automate PDF workflows
PDFs are the cockroaches of data formats — they survive every attempt to replace them, and every system eventually has to deal with them. The PDF.co API exists because developers keep hitting the same wall: they need to extract data from PDFs, convert between formats, or generate documents programmatically, and the open-source options (pdfplumber, PyPDF2, Camelot) each handle about 60% of real-world PDFs before choking on the rest.
Here is the direct answer: PDF.co is a cloud API that handles PDF parsing, data extraction (including OCR), document conversion, form filling, splitting, merging, and barcode reading through REST endpoints. According to PDF.co’s 2025 documentation, the API processes over 50 million documents monthly across 10,000+ business accounts (PDF.co). The McKinsey Global Institute estimates that knowledge workers spend 19% of their time searching and gathering information from documents (McKinsey).
Unlike generic AI automation posts, this guide shows real CodeWords workflows — not just theory.
Related reading: AI workflow automation, workflow automation platform, automated content creation, workflow builder, CodeWords integrations, CodeWords pricing, CodeWords templates.
TL;DR
- PDF.co API provides REST endpoints for PDF extraction, conversion, generation, OCR, and form filling — handling the edge cases that trip up open-source libraries.
- The API works best as a processing step inside a larger automation workflow: trigger → fetch PDF → extract/convert via PDF.co → write structured data to your destination.
- CodeWords can orchestrate PDF.co API calls alongside LLM processing, database writes, and notifications in a single serverless workflow.
What can the PDF.co API actually do?
The API covers six core capabilities. Each maps to a set of REST endpoints.
Data extraction. Extract text, tables, and form field values from PDFs. The /pdf/convert/to/text endpoint handles text extraction. The /pdf/documentparser endpoint uses templates to extract structured data from consistently formatted documents like invoices, receipts, and purchase orders.
OCR (optical character recognition). For scanned PDFs and images, the OCR engine extracts text that standard parsers cannot see. The /pdf/convert/to/text endpoint with OCR enabled handles this. Accuracy depends on scan quality — clean 300 DPI scans produce better results than phone photos.
Format conversion. Convert PDFs to and from HTML, CSV, JSON, XML, PNG, and DOCX. The /pdf/convert/to/csv endpoint is particularly useful for extracting tabular data from PDFs into a format that databases and spreadsheets can ingest.
PDF generation. Create PDFs from HTML, URLs, or raw text. The /pdf/convert/from/html endpoint renders an HTML string to PDF. Useful for generating invoices, reports, and certificates programmatically.
Document manipulation. Split PDFs by page, merge multiple PDFs, add watermarks, fill form fields, and add annotations. The /pdf/edit/add endpoint supports text and image overlays.
Barcode and QR code. Read barcodes and QR codes from PDF pages and images. Generate barcodes in common formats (Code 128, QR, EAN-13).
How do you set up the PDF.co API?
Setup takes five minutes.
Step 1: Get an API key. Sign up at pdf.co and grab your API key from the dashboard. The free tier includes 100 credits — enough for testing. Each API call costs 1–5 credits depending on the endpoint.
Step 2: Test with a simple call. Verify your key works with a basic text extraction:
POST https://api.pdf.co/v1/pdf/convert/to/text
Headers: x-api-key: YOUR_API_KEY
Body: { "url": "https://example.com/sample.pdf" }
The response returns the extracted text. If the PDF is hosted privately, you can upload it first via the /file/upload endpoint.
Step 3: Integrate into your workflow. In CodeWords, you can call the PDF.co API directly from a workflow. Describe the workflow to Cody:
Build a workflow that processes incoming invoice PDFs.
When a new PDF arrives in a Google Drive folder:
1. Download the PDF.
2. Call the PDF.co document parser to extract invoice number, date, vendor, line items, and total.
3. Validate the extracted data (check that total matches sum of line items).
4. Write the structured data to an Airtable base.
5. If validation fails, send a Slack alert with the PDF link and error details.
How do you extract structured data from PDFs?
The /pdf/documentparser endpoint is the most powerful extraction tool. It uses templates to map regions of a PDF to named fields.
For consistently formatted documents (invoices from the same vendor, bank statements from the same bank), create a template that defines extraction regions. PDF.co provides a visual template editor in their dashboard. Once the template is defined, every document in that format produces the same structured output.
For variable documents, combine PDF.co extraction with LLM processing. Extract the raw text via /pdf/convert/to/text, then pass the text to an LLM (OpenAI, Anthropic, or Gemini via CodeWords) with a prompt that asks for structured JSON output:
Extract the following fields from this invoice text:
- Invoice number
- Date
- Vendor name
- Line items (description, quantity, unit price, total)
- Subtotal, tax, total
Return as JSON.
This hybrid approach — PDF.co for extraction, LLM for structuring — handles documents that no template can anticipate. CodeWords provides both capabilities in a single workflow: PDF.co API calls for document processing and native LLM access for intelligent structuring.
What are the common pitfalls with PDF APIs?
Scanned vs. native PDFs. Native PDFs contain text data. Scanned PDFs are images wrapped in a PDF container. Extraction without OCR on scanned PDFs returns nothing. Always check whether OCR is needed — PDF.co’s text extraction endpoint returns an empty string for scanned documents when OCR is disabled.
Table extraction quality. Tables in PDFs are a visual arrangement, not a data structure. Complex tables with merged cells, multi-line rows, or nested headers confuse every PDF parser. The /pdf/convert/to/csv endpoint handles standard tables well. For complex tables, extract to text and use an LLM to parse the structure.
Rate limits and file size. The API has rate limits on concurrent requests and a file size cap (currently 16 MB per file, or 2,000 pages). For batch processing, implement queuing with delays between requests. CodeWords handles this through its serverless architecture — each PDF processes in its own isolated execution.
Encoding issues. PDFs from different systems use different text encodings. Non-Latin characters, right-to-left text, and special symbols may not extract cleanly. Test with representative samples before building production workflows.
How does PDF.co compare to alternatives?
vs. open-source libraries (pdfplumber, PyPDF2, Tabula). Open-source libraries are free and run locally. They handle simple, well-formatted PDFs reliably. They struggle with scanned documents, complex layouts, and edge cases. PDF.co costs credits but handles a broader range of documents and includes OCR. Use open-source for predictable document formats, PDF.co for variable or messy inputs.
vs. AWS Textract. Amazon Textract is an OCR and document analysis service with strong table and form extraction. It is priced per page and integrates well with the AWS ecosystem. PDF.co is cloud-agnostic and offers a broader feature set (conversion, generation, manipulation). Choose Textract if you are deep in AWS; choose PDF.co for a standalone document processing API.
vs. Google Document AI. Google’s offering excels at document classification and entity extraction with pre-trained models. It is tightly coupled to Google Cloud. PDF.co is simpler to set up and does not require a GCP project. For AI-powered document understanding, Google Document AI is stronger; for straightforward extraction and conversion, PDF.co is faster to implement.
FAQ
Is the PDF.co API free?
PDF.co offers a free tier with 100 credits. Paid plans start at $17/month for 5,000 credits. Each API call costs 1–5 credits depending on the endpoint. Check pdf.co/pricing for current rates.
Can I use PDF.co with n8n or Zapier?
Yes. PDF.co has native integrations with both platforms. n8n has a dedicated PDF.co node, and Zapier offers PDF.co as an app integration. For more complex workflows that combine PDF processing with AI, consider CodeWords where Cody builds the entire pipeline.
How accurate is PDF.co’s OCR?
Accuracy depends on scan quality. Clean, high-resolution scans (300+ DPI) typically achieve 95%+ character accuracy. Low-resolution scans, skewed images, and handwritten text reduce accuracy. For critical data, pair OCR extraction with AI validation in a CodeWords workflow.
Can PDF.co handle password-protected PDFs?
Yes. Pass the password as a parameter in the API call. The API supports both user and owner passwords for decryption.
Beyond extraction: PDF workflows as data pipelines
The PDF.co API is a processing step, not a complete solution. Its value multiplies when it sits inside a workflow that handles the before and after — fetching documents from email or cloud storage, validating extracted data, routing results to the right system, and alerting humans when something looks wrong.
The implication: document processing is becoming a commodity. The competitive advantage is in what you do with the extracted data, not the extraction itself.
Build your PDF processing workflow in CodeWords.




