API (SaaS): CLI
The attachmentAV CLI is a command-line tool for scanning files against the attachmentAV Virus and Malware Scan API.
Installation (#)
Prebuilt binaries for Linux, macOS, and Windows are attached to each GitHub release. Download the archive for your platform, extract it, and place attachmentav (or attachmentav.exe) somewhere on your PATH.
Example for Linux (x86_64):
curl -L -o attachmentav.tar.gz \
https://github.com/widdix/attachmentav-cli/releases/latest/download/attachmentav-vX.Y.Z-x86_64-unknown-linux-gnu.tar.gz
tar -xzf attachmentav.tar.gz
sudo mv attachmentav-*/attachmentav /usr/local/bin/
On macOS, clear the quarantine attribute after extraction:
xattr -d com.apple.quarantine /path/to/attachmentav
Authentication (#)
You need an attachmentAV API key to use the CLI. Sign up and create a key.
Export the key before running the CLI:
export ATTACHMENTAV_API_KEY=<API_KEY_PLACEHOLDER>
Usage (#)
Scan a file by path:
attachmentav path/to/file
Scan data piped on stdin:
cat path/to/file | attachmentav
curl -s https://example.com/some-file | attachmentav
Pass --json to receive the raw API response instead of a human-readable status.
Regions (#)
The CLI defaults to the eu region. Select a different regional endpoint with the --region flag or the ATTACHMENTAV_REGION environment variable:
attachmentav --region us path/to/file
ATTACHMENTAV_REGION=canada attachmentav path/to/file
Valid values: eu (default), us, canada, india.
Exit codes (#)
The CLI is designed to be used in shell scripts and CI pipelines. It exits with:
0— file is clean1— file is infected2— error (I/O, authentication, network, or unexpected response)