October 20, 2026 · 5 min read
A MALWARE SCANNING API INSTEAD OF SELF-HOSTING A SCANNER
When a product starts accepting uploads, the first plan for scanning them is usually to run an open-source antivirus engine next to the app. The engine is free and well known, and a container image is a search away. The engine is the small part. Everything around it is the work.
What running your own scanner takes
- A daemon that holds the signatures in memory. Scanning each file from a cold start takes too long, so the engine runs as a long-lived process with its signature database loaded. That takes more than a gigabyte of memory, about double that for a short time while it reloads new definitions, and the commonly recommended host has 3 to 4 GB.
- Definition updates. The engine only knows the threats in its last update. Something has to fetch new definitions several times a day, stay within the update mirrors' rate limits, and alert you when updates stop, because a scanner on old definitions keeps answering “clean”.
- An HTTP API in front of it. The daemon speaks its own socket protocol, with no authentication when exposed over TCP. Your app needs an endpoint, written or adopted and then maintained, that accepts a file, streams it to the daemon, and turns the output into a verdict your code can act on.
- Somewhere to run it that is not your app server. Scanning is CPU and memory heavy. On the same machine as your API, a burst of uploads slows every other request.
- Handling untrusted files safely. Files written to disk, archives unpacked, a parser run against hostile input. The scanner is the one component built to touch malware, so it belongs in its own isolated environment.
- Scaling and queueing. One daemon scans a limited number of files in parallel, bounded by its memory and CPU. More traffic means a queue, more instances, and each new instance loading the full signature set before it can scan anything.
- Deciding what a result means. Signature hits, heuristic warnings, encrypted archives the engine could not open, and the engine failing outright all need a rule. A failure that is read as “no threat found” lets files through.
When self-hosting is the right call
- Air-gapped systems, where files cannot leave the network at all.
- Strict data residency, where a file may not be processed outside a given country or account, even briefly.
- Very high volume, where the servers cost less than per-scan pricing and you have people to run them.
- Custom detection tuned to your own data, maintained by a security team.
If none of those apply, the scanner is infrastructure you run so that you can answer one question about each file.
What a hosted API replaces
- The daemon, its memory and its updates: the service keeps the engines and definitions current.
- The wrapper: a few HTTP calls with an API key in a header, or one SDK call.
- The separate machines and the queue: your upload handler gets a scan id back at once and the verdict later, by polling or a webhook.
- The rules: a single verdict of clean, suspicious or malicious, and a scan that could not finish is reported as failed rather than clean.
What you give up is control over where the file is processed. Check where that is and what the service does with the file. Bouncer processes files on AWS in Mumbai (ap-south-1). Bouncer uses file content for nothing but the scan, does not share scan results with other users or third parties, and deletes the file after the scan, within 24 hours at most (see the privacy policy). The scan record (verdict, file name, hash) stays in your dashboard while the account is active. Our comparison of free malware scanning APIs covers how other services handle this.
Trying Bouncer
Bouncer runs multiple detection engines on every file. The free tier includes 500 scans a month, no credit card.
Sign in with Google and create an API key in the dashboard. A scan is three calls: create it, upload the file straight to storage, then read the verdict. Files can be as large as your tier allows, 25 MB on the free tier. The example uses jq to read the JSON responses.
# 1. Create the scan. The response holds the scan_id and an upload target
RESP=$(curl -s -X POST https://api.usebouncer.dev/v2/scan \
-H "X-API-Key: $BOUNCER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"file_name": "invoice.pdf"}')
SCAN_ID=$(jq -r .data.scan_id <<<"$RESP")
# 2. Upload: every field from data.upload.fields, then the file last.
# The upload starts the scan.
fields=()
while IFS= read -r kv; do fields+=(--form-string "$kv"); done \
< <(jq -r '.data.upload.fields | to_entries[] | "\(.key)=\(.value)"' <<<"$RESP")
curl -X POST "$(jq -r .data.upload.url <<<"$RESP")" "${fields[@]}" -F file=@invoice.pdf
# 3. Read the verdict, or register a webhook instead
curl https://api.usebouncer.dev/v2/scan/$SCAN_ID \
-H "X-API-Key: $BOUNCER_API_KEY"With the Node SDK it is one call:
import { Bouncer } from "@usebouncer/sdk";
const bouncer = new Bouncer(process.env.BOUNCER_API_KEY ?? "");
const result = await bouncer.scan("./invoice.pdf");The docs cover verdicts, webhooks and errors. Get started with Bouncer.