CLI
CamScanner CLI is a command-line tool for document processing. It is designed for local terminals, project scripts, test jobs, and automated workflows that need explicit control of inputs, parameters, outputs, and cloud-saving behavior.
When to use it
- Quickly verify document capabilities in development or testing.
- Encode fixed processing steps in scripts or project commands.
- Batch-convert, merge, and organize local documents.
- Control output formats, paths, and cloud-saving behavior explicitly.
Prerequisites
- A Node.js environment that can install npm packages.
- macOS, Linux, or Windows on x64 or arm64.
- A browser available for CamScanner OAuth sign-in on first use.
- Ownership of, or permission to process, every input file.
Installation choice
For projects, install locally and use npx so the project can pin a version. Install globally when the command must be available across directories.
Quick setup
Ask an agent to install it
Set up CamScanner CLI in this environment using npm install camscanner-cli. First identify the package manager and decide whether a local or global installation is appropriate. Explain which files will change, preserve existing lockfiles, then install and verify with an available help or version command. Tell me how to invoke it afterward.Install in the current project
npm install camscanner-cli
npx camscanner-cli --versionThe package selects a native binary for the current OS and CPU. Do not use --omit=optional, because platform binaries are distributed as optional dependencies.
Install globally
npm install -g camscanner-cli
camscanner-cli --versionCommands below use camscanner-cli; prefix them with npx for a local installation.
Sign in
camscanner-cli auth status
camscanner-cli auth loginThe login command opens a browser and waits in the foreground for authorization. Verify with auth status afterward. To sign out:
camscanner-cli auth logoutCommand structure
camscanner-cli <group> <command> [file...] [flags]| Group | Purpose |
|---|---|
image | Scan and image enhancement, OCR, conversion, translation, detection, editing, and multi-image merging |
pdf | PDF conversion, page rendering, and watermarks |
txt | Text conversion |
doc | Cloud document search, download, movement, and folder queries |
auth | Sign-in status and authorization |
camscanner-cli --help
camscanner-cli image --help
camscanner-cli pdf --helpCommon commands
Image OCR
camscanner-cli image ocr document.jpg
camscanner-cli image ocr document.jpg > result.txtImage to Word or Excel
camscanner-cli image convert document.jpg --format word -o result.docx
camscanner-cli image convert table.png --format excel -o result.xlsxPDF to Word or Markdown
camscanner-cli pdf convert report.pdf --format word -o report.docx
camscanner-cli pdf convert paper.pdf --format md -o paper.mdRemove scan shadows
camscanner-cli image enhance scan.jpg --mode 5 -o enhanced.jpgMerge images into PDF
camscanner-cli image merge-pdf "page1.jpg" "page2.jpg" "page3.jpg" -o merged.pdfList files explicitly and confirm the order. A run accepts up to 100 images; avoid unordered *.jpg wildcards.
Translate an image
camscanner-cli image translate menu.jpg --lang en -o menu-en.jpgRecognize an invoice or receipt
camscanner-cli image receipt invoice.jpgSearch cloud documents
camscanner-cli doc search "contract"Show search results and confirm the target before downloading or moving a document.
Local and cloud output
| Option | Behavior |
|---|---|
-o, --output <path> | Save to a specified local path |
-s, --save | Save to CamScanner cloud |
--save-title <title> | Set the cloud document title |
--save-dir <name> | Select a cloud folder by name |
--save-dir-id <id> | Select a cloud folder by ID |
Local and cloud output can be combined:
camscanner-cli pdf convert contract.pdf \
--format word \
-o contract.docx \
-s \
--save-title "Purchase contract-editable"With only -s, the result is saved only to the cloud; with only -o, it is saved only locally. Not every output type supports -s; check the command's --help.
Existing files
An -o path may overwrite an existing file. Check the path first or generate a non-conflicting filename.
Use in scripts
The CLI reports success through exit codes and can be used in Shell or CI workflows. Specify input and output paths explicitly and retain error output for diagnosis.
The first run requires browser OAuth. For unattended environments, authorize securely beforehand; never commit credentials, access tokens, or authentication directories. The public setup flow does not support plaintext tokens in documentation or configuration.
Update and uninstall
Project installation:
npm update camscanner-cli
npm uninstall camscanner-cliGlobal installation:
npm install -g camscanner-cli@latest
npm uninstall -g camscanner-cliAfter updating, run camscanner-cli --version. If both local and global copies exist, compare npx camscanner-cli --version with camscanner-cli --version.
Troubleshooting
Installed but command not found
Use npx camscanner-cli for a local installation. For a global installation, ensure npm's global binary directory is in PATH.
Missing binary for this platform
Confirm the OS and architecture and reinstall without omitting optional dependencies.
Login keeps waiting
auth login waits for browser authorization. Complete sign-in in the browser; if the page does not open, check the default browser and network.
File processing fails
Run the command's --help, then verify the format, size, and file integrity. Do not repeatedly retry an invalid parameter.
Cloud result was saved to the root directory
When a folder specified by --save-dir is not found, the CLI may fall back to root and print a warning. Run camscanner-cli doc dirs or use an explicit --save-dir-id.
Limits and security
- A single upload should not exceed 40 MB.
- Image input supports JPG, JPEG, and PNG; document input supports PDF, TXT, and Markdown.
- PDF watermark operations support up to 100 pages; password-protected PDFs are unsupported.
- Inputs are uploaded to CamScanner servers;
-ssaves results to the signed-in account. - Never expose or commit sign-in tokens.
- Confirm the scope, page order, and output path before batch, overwrite, download, or move operations.
Next steps
- See Skill for natural-language capability selection and command composition.
- See MCP for a standard agent, AI IDE, or workflow connection.
- See Supported capabilities for the documented capability scope.

