cd /news/ai-agents/how-to-automate-pharmacy-invoice-dow… · home › topics › ai-agents › article
[ARTICLE · art-149939] src=skyvern.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

How to Automate Pharmacy Invoice Downloads

Skyvern published a guide for automating pharmacy invoice downloads, in which an AI agent signs in to wholesaler portals such as McKesson Connect, selects a pharmacy account, filters by invoice date range, and retrieves PDF invoices across every page of results. The company offers 5000 free credits and recommends building the first version with its Copilot tool, which opens the agent in Studio, then connecting a saved portal login with optional two-factor authentication via authenticator app or Gmail/Outlook integration. The guide instructs users to start with one pharmacy account and a verifiable billing period before scaling, and notes the same approach applies to PBM portals for remittance or payment records.

by read7 min views1 publishedOct 14, 2026
How to Automate Pharmacy Invoice Downloads
Image: Skyvern (auto-discovered)

When your accounting team needs an invoice from a wholesaler portal, somebody has to go and get it. They sign in, pick the pharmacy account, find the right billing period, download the PDFs, and file them. Then they repeat the process in the next portal. And then the next... Every billing cycle!

I know the pain. We built Skyvern for healthcare workflows like this.

You give an AI agent a job to do in the browser, and it works through the website to do it. For pharmacy invoice collection, that means navigating the portal and retrieving the documents your team would otherwise download by hand.

In this article I'll show you exactly how to automate pharmacy invoice downloads using Skyvern.

If you'd rather skip the explanation, you can give Skyvern a spin. We offer 5000 free credits. Enough to build and run your first few automated workflows.

Start with the job your team already does #

I recommend to start by watching someone collect a batch of invoices. That tells you what the automation needs to do far more clearly than a request to "automate billing."

For example, for someone down invoices from McKesson Connect it might look like this: They sign into McKesson Connect, switch to a particular pharmacy account, filter by invoice date, and work through several pages of results. They know which account belongs to which location. They know whether accounting needs individual invoices, credit memos, or a statement.

Those seem like small details but they need to become part of the instructions if you want to automate it properly.

So make note of each step and what actions/decisions are made at every step.

Now, let's take a simple example: your team needs September's invoices for account 1042. A useful instruction could be:

Open the wholesaler portal using the saved login. Select account 1042 and find invoices dated September 1 through September 30, 2026. Download each invoice, including results on later pages. Report the invoice numbers downloaded and anything you couldn't retrieve.

You can use the same approach for PBM portals, though you're usually collecting remittance or payment records there.

They key is to start small, verify it works and scale from there.

Let Skyvern work through the portal #

Start with one pharmacy account and a billing period you can check yourself.

I recommend using Copilot to build the first version, then test whether it delivers the documents accounting needs.

1. Give Copilot the invoice collection job.

Open Skyvern and choose Home. Paste the following into the task box, replacing [portal URL] with your wholesaler's sign-in page: Build an agent that signs in to [portal URL] and downloads PDF invoices for a pharmacy account and invoice-date range. Make the account number, start date, and end date inputs. Check every page of results. Return the downloaded files, their invoice numbers, and any invoices you couldn't retrieve. Ask me to select a saved login.

Click the send arrow. Copilot opens the agent in Studio and starts building it. Answer any questions it asks about the portal. Copilot quickstart.

2. Connect the portal login.

When Copilot asks to sign in, choose the account under Saved logins. To add one, open Credentials, click Add, and choose Password. Enter a recognizable name, the login page URL, username, and password. Save it, then return to Copilot and select that login.

If the portal requires MFA, expand Two-Factor Authentication on the credential. For authenticator codes, select Authenticator App and add the setup key or scan its QR code. For email codes, connect Gmail or Outlook through Integrations, then select that inbox. SMS codes need the separate code delivery setup. Our authentication guide explains how saved logins work.

3. Check how each invoice will be downloaded.

For individual invoice downloads, ask Copilot to gather the matching invoice list across all results pages, then use a Loop to download each invoice. Click Review on its proposed changes, check the account and date filters, and click Accept when the steps match the job. In Editor, open the File Download block inside the loop. Set Download Goal to Download the original PDF invoice for this item: {{ current_value }}. Set Download Timeout (sec) to 120 for the first test, increasing it if the portal needs longer. Save with the save icon. Studio guide.

4. Send the files to the destination accounting uses.

If your team stores invoices in S3 or Azure Blob Storage, add a **Cloud Storage Upload** block after the downloads. In Editor, hover over the **+** between blocks, choose **Add Block**, and select it.

For S3, choose **Amazon S3** under **Storage Type**. Enter the bucket, region, and AWS credentials supplied by the person who manages that storage. Set **Folder Path** to a location such as `invoices/wholesaler/1042/2026-09`, then save the agent. The [file delivery guide](https://www.skyvern.com/blog/file-download-automation-cloud-storage/) covers the broader workflow.

5. Run a complete batch and open the results.

Click Run, enter the pharmacy account and date range, and click Run agent. Watch the Browser pane to check that it reaches the correct account and billing period.

When it finishes, open Run → Outputs → Downloaded files. Open a PDF to check its contents, then compare the invoice numbers against the portal and confirm the files reached the destination folder. If a block fails, inspect Timeline and use Fix with Copilot to propose a correction before running it again. Run and output controls.

Get this collection process working before adding invoice data extraction. Keep the original PDFs so accounting can refer back to them.

Judge the workflow by the files accounting receives #

I would judge this automation by whether the team gets a complete, usable batch of documents.

Suppose the portal lists twelve September invoices for account 1042 and eleven arrive in the destination folder. The workflow should identify the missing invoice and leave the batch open for review. Accounting needs to know what's missing without signing back into the portal to repeat the whole search.

That requires comparing the portal's invoice list with the files delivered. Count the documents, but check their identifiers too. Twelve files can include a duplicate and still leave one invoice missing.

Keep a record of the account, billing period, invoice numbers, and delivery result. If the job runs twice, it should recognize documents already collected. If an invoice has been revised, preserve that distinction so the team can review the change.

Plan your error handling so failures are specific enough to act on. An expired login needs the account owner. A report that hasn't finished generating needs another check. A failed upload needs delivery retried, with the downloaded file retained. A search that correctly finds no invoices should report that outcome.

This is where much of the value comes from. Your team should be able to work from the collected files and a short list of exceptions. If everyone still has to revisit every portal after each run, the workflow needs more work.

Start with the portal your team visits most #

Choose a portal that creates regular work for your team and use a billing period you can check manually. Run the automation, compare its output with the portal, and fix the gaps before putting it on a schedule.

Then run the same period again. Confirm that existing invoices don't become duplicate accounting inputs. Try an empty period and check that the workflow reports it correctly. Make sure an interrupted run leaves enough information for someone to finish the job.

Measure how much staff time the whole process takes, including reviewing exceptions. That gives you a useful basis for comparing the savings with the cost of running and maintaining the automation.

Once that portal is working, add the next one. Reuse the parts that apply, including the filing convention and completion checks, while configuring the new account and download flow. Set the schedule around when documents become available and when accounting needs them. Leave room for another pass when a supplier posts something late.

If your team is still collecting pharmacy invoices by hand, book a Skyvern demo. Show us the portal and the job your team does today, and we can work through how to automate it.

── more in #ai-agents 4 stories · sorted by recency
── more on @skyvern 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-automate-phar…] indexed:0 read:7min 2026-10-14 · —