AI-Rename Vendor Invoices in Zapier: A 5-Step Dropbox + PDF4me Workflow

The painful part of accounts payable is not paying invoices, it is finding the right invoice in storage when somebody asks for it three weeks later. Every vendor names files differently, every scan is untitled (3).pdf, every Dropbox folder turns into a pit. The fix is to let the AI read the invoice the moment it lands, pull out the customer name, and rename the file before it ever hits long-term storage. This walkthrough builds the exact pattern in Zapier with PDF4me AI - Document Parser, Dropbox, and a 2-line Code by Zapier step. Five Zap steps. Real screenshots from a working Zap. The vendor name becomes the filename. Search just works again.
Two Dropbox steps frame the Zap. PDF4me's AI parser reads the invoice. A two-line Code step turns the parser output into mappable tokens. The vendor name becomes the filename. The Zap runs in under 10 seconds end-to-end on a 1-page invoice. No custom Analyzer required, the built-in default_invoice_extraction covers most vendor invoices out of the box.
Why-Based Q&A
Why two Dropbox steps at the start? The New File in Folder trigger gives you metadata (name, path, ID) but not always a clean file binary that downstream apps can re-upload. Find File reads the file properly so PDF4me gets a real document to parse and step 5 has bytes to upload. Same pattern works on SharePoint or OneDrive with the matching connectors.
Why a Code step in the middle? The AI parser returns its extracted data as a JSON string on the Doc Text output. Zapier displays it as one big blob unless you parse it. Two lines of JSON.parse inside Code by Zapier turn that blob into a real object whose keys (Customer Name, Invoice Number, totals) become individually mappable tokens in step 5. The Make equivalent is a Parse JSON module.
Why default_invoice_extraction? It is the built-in Analyzer that ships with PDF4me, tuned for typical vendor invoices. Switch to a custom Parse Analyzer when you need fields the default does not cover, or to a Classify Analyzer when one Zap must handle several vendor layouts in a single run.
Why rename instead of move to a vendor folder? Both work, you can chain a Dropbox Move File step after this Zap to also slot it into a vendor sub-folder. Renaming first means search-by-name returns the right invoice instantly even if the folder hierarchy ever changes.
What You'll Get
Input: A vendor invoice PDF dropped into a watched Dropbox folder (/MuneerTrigger in this walkthrough; any inbox folder works). Output: The same PDF re-uploaded to /pdf4meoutput named after the vendor's Customer Name (e.g. HEADWAY TECHNOL…1; RENT 3.6-2MB.pdf). The original file is left alone in the trigger folder so you can keep an audit trail.
What You Need
- Zapier. Open Zapier. The Code by Zapier step needs at least a Starter plan; everything else works on the free tier.
- PDF4me API key. Get your API key. You'll connect it the first time you add a PDF4me action.
- Dropbox. For both the inbox folder (trigger) and the output folder (Upload File). SharePoint / OneDrive / Google Drive work the same with their respective connectors.
- A sample vendor invoice. Any PDF with a visible vendor / customer name. The walkthrough uses
sample-vendor-invoice.pdf, you can download the exact file used in this walkthrough and drop it into Dropbox to mirror every screenshot.
Grab the sample first. Click below to download the same vendor invoice the screenshots use. Drop it into your Dropbox trigger folder before publishing the Zap so the first test run produces the same Customer Name token you see in the final upload step.
The Zap at a Glance
- Dropbox: New File in Folder (trigger). Polls a watched folder every few minutes for new files.
- Dropbox: Find File. Looks up the new file by name to get its binary content into the Zap.
- PDF4me: AI - Document Parser. Runs the
default_invoice_extractionAnalyzer. - Code by Zapier: Run JavaScript. Two lines that
JSON.parsethe Doc Text into a real object. - Dropbox: Upload File. Writes the file back with Customer Name as the new filename.
Complete Zap overview

Five steps. Each card shows a green checkmark when configured. PDF4me sits in the middle; the Code step turns the parser output into mappable tokens.
Step 1: Dropbox – New File in Folder (Trigger)
Zap so far: trigger only.
- In Zapier click + Create Zap.
- Pick Dropbox as the trigger app, New File in Folder as the event.
- Connect your Dropbox if you have not already.
- Configure:
- Space:
Default - Folder:
/MuneerTrigger(or whatever inbox folder vendors drop into) - Include files in subfolders?:
False - Include file contents?:
Yes(important, gives downstream steps a clean binary fallback) - Include sharing link?:
Yes(optional, useful if you want to send a link in Slack later)
- Space:
- Test trigger. Drop a sample invoice into the folder, Zapier should return one new file record.
Trigger configuration

The trigger watches the inbox folder and polls every 2 minutes by default on Starter, faster on higher plans.
Step 2: Dropbox – Find File
Zap so far: trigger → Find File.
The New File trigger gives you a file name and path, but Find File guarantees a clean, downloadable binary that the next steps can re-use. Add it.
- Click + below the trigger. Pick Dropbox, Find File.
- Configure:
- Space:
Default - Folder:
/pdf4metest/sample(the folder where the file actually lives, often the same as the trigger folder) - Include files in subfolders?:
False - File Name (required): pick the File Name token from the trigger (it auto-fills as you type)
- Include file contents?:
Yes - Include sharing link?:
Yes - Successful if no search results are found?: leave default (
False, halts the Zap) - If multiple search results are found: leave default (
Return first search result)
- Space:
- Test action. Zapier should hand back the file with binary content.
Find File configuration

Find File gives the downstream PDF4me action and Upload File step a guaranteed clean binary, not just a Dropbox link.
Step 3: PDF4me – AI - Document Parser
Zap so far: trigger → Find File → AI - Document Parser.
This is where the AI reads the invoice and extracts structured fields. The default Analyzer covers typical vendor invoices; you can swap to a custom Analyzer later for industry-specific fields.
- Click +. Search PDF4me, pick AI - Document Parser.
- Connect PDF4me with your API key (first time only, reuse across all PDF4me actions).
- Configure:
- File: pick the File token from step 2 (Find File). Leave File URL empty, you have a file already.
- File Name: concatenate the File Name and File Ext tokens from step 2 so the action receives the original name with the right extension.
- AI Analyzer Name:
default_invoice_extraction(the built-in invoice template)
- Test action. Inspect the response. You should see a
Doc Textfield containing a JSON string with extracted fields, plus individual tokens likeCustomer Name,Invoice Number, totals, line items.
Tip. If default_invoice_extraction misses a field you need (vendor VAT number, HSN codes, custom line-item columns), build a custom Analyzer in the AI Document Parser dashboard and reference its Id here. Same action, different schema. Zero Zap rebuild.
Step 4: Code by Zapier – Run JavaScript
Zap so far: trigger → Find File → AI - Document Parser → Run JavaScript.
The AI parser returns its data as a JSON string on the Doc Text output. Zapier displays it as a single token. To map individual fields (Customer Name, Invoice Number, etc.) into the next step, parse it into a real object first.
- Click +. Pick Code by Zapier, event Run Javascript.
- Input Data: add one entry.
- Name:
data2 - Value: pick the Doc Text token from step 3 (PDF4me).
- Name:
- Code (paste exactly):
const parsed = JSON.parse(inputData.data2);
return parsed;
- Test action. The output should expose every field from your Analyzer schema as an individual token:
parsed customerName,parsed invoiceNumber,parsed totalAmount, etc.
Run Javascript configuration

Two lines turn the AI parser's JSON blob into individually mappable Zapier tokens. Make's equivalent is a Parse JSON module.
No-Code variant. If you cannot use Code by Zapier (e.g. free plan), use the Formatter by Zapier → Utilities → Pick from List or Lookup Table patterns to grab specific values from the raw Doc Text string. Less elegant, but free.
Step 5: Dropbox – Upload File (Smart Rename)
Zap so far: trigger → Find File → AI - Document Parser → Run JavaScript → Upload File.
This is the payoff. Take the file from step 2 and re-upload it with the extracted Customer Name as the filename.
- Click +. Pick Dropbox, Upload File.
- Configure:
- Space:
Default - Folder:
/pdf4meoutput(or wherever your renamed invoices should live) - File: pick the File token from step 2 (Find File)
- Overwrite:
True(orFalseif you want to fail loudly on duplicates) - Specify File Name: pick the Customer Name token from step 4 (the parsed JSON)
- Specify File Extension: pick the File Ext token from step 2
- Include sharing link?:
Yes
- Space:
- Publish the Zap.
Upload File configuration

The AI-extracted Customer Name token feeds straight into Specify File Name. The original extension keeps the file openable as PDF.
Run the Zap and Verify
- Toggle the Zap On.
- Drop a sample invoice PDF into
/MuneerTrigger. - Wait for the trigger poll (up to 2 minutes on Starter). Check Zap History, all five steps should be green.
- Open Dropbox
/pdf4meoutput. The file is there, named after the vendor's Customer Name with the original extension preserved.
What did you actually build? A zero-touch AP intake that turns chaotic vendor invoice filenames into a searchable archive keyed by customer name. The AI handles the variation, the Code step handles the JSON, Dropbox handles the storage. Same pattern works in Make (use a Parse JSON module instead of Code) and Power Automate (use Parse JSON action).
Common Variations You Can Add Without Rebuilding
New invoice from {{customerName}} for {{totalAmount}} due {{dueDate}}, file at {{Upload File sharing link}}. Visibility without manual notification./pdf4meoutput/{{customerName}}. Auto-creates one folder per vendor.default_invoice_extraction for a Classify Analyzer Id holding one Schema per vendor. Use Zapier Paths after step 4 to branch on the Classification Name and rename / archive per vendor.Troubleshooting
Make sure you mapped the File token from step 2 (Find File), not from step 1 (the trigger). The trigger sometimes ships only metadata; Find File always ships a binary.
default_invoice_extraction recognises typical layouts. If your vendor uses an unusual one and customerName comes back blank, build a custom Parse Analyzer with a field description like "Customer name as printed on the invoice header, sometimes labelled Buyer, Bill To, or Ship To." Pick that Analyzer in step 3 instead.
The AI parser returns plain text on rare malformed runs. Wrap the parse in a try / catch and fall back to returning the raw string so the Zap does not break: try { return JSON.parse(inputData.data2) } catch (e) { return { raw: inputData.data2 } }.
Two vendors with the same Customer Name will collide. Either set Overwrite to True in step 5 (last write wins) or append the Zap's {{zap_meta_human_now}} token to the filename for uniqueness.
Next Steps
↓ Download sample-vendor-invoice.pdf
The same five-step pattern (trigger → fetch → AI parse → parse JSON → write) works for any AI extraction in Zapier. Once you ship one, the next ones cost almost nothing.