Building a Next.js / Node.js Webhook Consumer for Asynchronous Document OCR (planned, not yet available)
PDFparse's public API, SDKs and webhooks are planned and not available yet; the examples below are previews of the intended design. Handle high-concurrency document processing completions in Node.js or Next.js API routes with cryptographic signature validation.
Large batch files (e.g. 200-page loan packages) take 10-30 seconds to parse. Polling exhausts server resources.
Step-by-Step Walkthrough
Create the Webhook Route in Next.js
Create an endpoint at app/api/pdfparse-webhook/route.ts to listen for POST callbacks.
// app/api/pdfparse-webhook/route.ts
import { NextResponse } from "next/server";
export async function POST(req: Request) {
const payload = await req.json();
const { documentId, executionStatus, outputUrl } = payload;
console.log(`Document ${documentId} finished with status ${executionStatus}`);
// Save outputUrl to database or trigger downstream job
return NextResponse.json({ received: true });
}Pass the Webhook URL During Upload
When submitting large files via POST /v1/upload, include the webhookUrl in your form parameters.
Verify Webhook Signature
Verify the X-PDFparse-Signature header using your secret webhook signing key to ensure requests originate from our servers.
Instant Downstream Automation
Download the converted XLSX or JSON from the secure ephemeral downloadUrl and dispatch email notifications to your end users.
A robust asynchronous event-driven document processing microservice.
Try the Relevant Tool or Agent
Upload your document to process this exact workflow in your browser with automated table detection and layout preservation.