Node.js PDF API
Connect PrefillPDF to Next.js, Express, NestJS, serverless functions, queues, and TypeScript applications.
Common Node.js workflows
Next.js API route
Receive form or database data, call PrefillPDF on the server, and return a PDF response or URL.
Upload and extract
Accept an uploaded PDF, send it for extraction, and store the normalized fields in your application.
Queue-based generation
Generate documents through background jobs to support larger workloads and retries.
How the integration works
Create a server-side request
Keep API credentials on the server and call PrefillPDF with fetch, Axios, or another HTTP client.
Send document input
Use JSON for generation or file/multipart input for extraction.
Handle the result
Parse JSON responses, stream files, or save the result to object storage.
Add retries and logging
Track failed jobs and retry transient errors in production workflows.
Node.js request example
const response = await fetch("https://api.prefillpdf.com/fill-pdf", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PREFILLPDF_API_KEY}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
template_id: "your-template-id",
data: {
customer_name: "Jane Smith",
amount: 25000,
},
}),
});
if (!response.ok) {
throw new Error(`PrefillPDF request failed: ${response.status}`);
}
const result = await response.json();Benefits of using PrefillPDF with Node.js
FAQ
Should I call PrefillPDF from the browser?
No. Keep your API key private and call PrefillPDF from a server route, backend service, or serverless function.
Can I use this in Next.js App Router?
Yes. Use a Route Handler, server action, or backend service function depending on your architecture.
Can Node.js process extraction JSON before saving it?
Yes. Validate, transform, normalize, and enrich the returned data before storing it.
Related integrations
Build your Node.js PDF workflow
Generate PDFs from structured data or extract structured JSON from existing documents with PrefillPDF.