Use Case

Extract Data from Government PDF Portals

Government portals serve PDFs as auto-downloads behind redirect chains and URL tokens. PDFPipe handles the full path - from public URL to page text - in a single API call.

Why government PDFs are the hardest to automate

Government agencies publish millions of reports, filings, and compliance documents as PDFs. These are some of the most valuable data sources for analytics, compliance monitoring, and research - and some of the hardest to access programmatically.

The URLs rarely point directly to a PDF file. Instead, they go through redirect chains, one-time tokens, and JavaScript download triggers. A link likeportal.gov/reports/download?id=12345might redirect three times before the browser finally captures the file. Standard HTTP clients get an HTML page or an empty response.

PDFPipe solves this by using a headless browser that follows the full navigation path, captures the PDF regardless of how it is served, and returns its text in your chosen format.

Two limits worth knowing. PDFPipe does not send cookies or credentials, so portals that require a login are not supported - public records only. And many older government PDFs are scans; those have no text layer and come back empty, because PDFPipe does not do OCR. Digital-born filings work well. Portals behind aggressive bot protection can also block the headless browser.

One POST request. We handle the rest.

Request (curl)
curl -X POST https://api.pdfpipe.dev/v1/convert \
  -H "Authorization: Bearer pk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://portal.agency.gov/reports/download?id=2025-Q1",
    "format": "json",
    "returnMethod": "inline"
  }'
Response
{
  "requestId": "req_a1b2c3...",
  "status": "queued",
  "pollUrl": "/v1/status/req_a1b2c3..."
}

// ...then GET /v1/status/req_a1b2c3...?returnMethod=inline:
{
  "requestId": "req_a1b2c3...",
  "status": "complete",
  "format": "json",
  "type": "attachment",
  "detectedType": "attachment",
  "pagesProcessed": 24,
  "creditsUsed": 1,
  "contentType": "application/json",
  "content": "{\"pages\":[{\"pageNumber\":1,\"text\":\"Annual Compliance Report...\"}],...}"
}

Works with any language

PDFPipe is a REST API. Any language or tool that can make HTTP requests can use it - JavaScript, Python, Go, Ruby, or no-code platforms like Power Automate and Zapier.

JavaScriptPythonGoRubyPHPJavaC#curl
Node.js
const headers = {
  "Authorization": "Bearer pk_...",
  "Content-Type": "application/json",
};

const res = await fetch("https://api.pdfpipe.dev/v1/convert", {
  method: "POST",
  headers,
  body: JSON.stringify({
    url: "https://portal.agency.gov/reports/download?id=2025-Q1",
    format: "json",
    returnMethod: "inline",
  }),
});
let job = await res.json();

// Download-triggering links run through the headless browser,
// so they are queued (202). Poll until complete.
while (job.status !== "complete" && job.status !== "failed") {
  await new Promise((r) => setTimeout(r, 5000));
  const poll = await fetch(
    `https://api.pdfpipe.dev/v1/status/${job.requestId}?returnMethod=inline`,
    { headers },
  );
  job = await poll.json();
}

if (job.status === "failed") throw new Error(job.error.message);

const doc = JSON.parse(job.content);
// doc.pages[n].text, doc.metadata, doc.totalPages

Start extracting government PDF data today

Free tier includes 300 requests per month. No credit card required.