CLI

Run Snapshot Site from your terminal, scripts, and CI jobs

Use the Snapshot Site CLI when you want reproducible screenshot, analyze, and compare jobs from the shell without wiring a full SDK first.

@snapshot-site/cli
Official CLI
Shell first
CI, scripts, local ops
Save assets
Images and JSON to disk
Install:pnpm add -g @snapshot-site/cli
Auth:SNAPSHOT_SITE_API_KEY=ss_live_xxx
Get started for free
CLI workflow
Snapshot Site themed screenshot API CLI workflow illustration
Good fits
CI screenshot checks before deployment
Local compare jobs against staging and production
Quick QA capture tasks without app code
Saving returned assets directly to disk for review

CLI overview

The CLI gives teams a direct operational interface to Snapshot Site. It is useful when the workflow starts in the shell, in CI, or in a small automation script.

1

No wrapper app required

You can run screenshot, analyze, and compare directly from the terminal.

2

Works well in CI and ops workflows

The CLI is a good fit for scripted checks before deployment or for recurring operational reviews.

3

Supports saved local config

You can log in once locally instead of exporting an API key in every shell session.

4

Easy asset export

Returned screenshots and JSON payloads can be written straight to disk for review.

Quick start

Install, authenticate, run commands

1

Install `@snapshot-site/cli` globally

2

Export `SNAPSHOT_SITE_API_KEY` or run `snapshot-site login`

3

Call `snapshot-site screenshot`, `analyze`, or `compare`

4

Save JSON or image outputs locally for review

Command examples

Screenshot

Take a screenshot

Capture a page and save both JSON output and an image locally.

snapshot-site screenshot \
  --url https://snapshot-site.com/pricing \
  --width 1440 \
  --full-size \
  --hide-cookie \
  --output ./pricing.json \
  --save-image ./pricing.png
Analyze

Analyze a page

Run page analysis and persist both the JSON payload and image.

snapshot-site analyze \
  --url https://snapshot-site.com \
  --width 1440 \
  --full-size \
  --enable-summary \
  --enable-quality \
  --output ./analysis.json \
  --save-image ./analysis.png
Compare

Compare staging and production

Compare two URLs and save the result set locally.

snapshot-site compare \
  --before-url https://snapshot-site.com/pricing \
  --after-url https://staging.snapshot-site.com/pricing \
  --width 1440 \
  --full-size \
  --hide-cookie \
  --threshold 0.1 \
  --output ./compare.json \
  --save-image ./compare-assets
Auth

Persist local credentials

Store credentials locally when you do not want to export the API key every time.

snapshot-site login --api-key ss_live_xxx
snapshot-site whoami-config
snapshot-site logout

# saved config path
~/.config/snapshot-site/config.json

A command-line workflow that can graduate into automation

The CLI is useful when a developer needs immediate feedback without writing an application wrapper. It also provides a reviewed command contract that can later move into a CI job or operational script. The command should still define the visual state: target, viewport, full-page choice, readiness, cleanup, and output destination.

Use a harmless public fixture while verifying installation and authentication. Once the command succeeds, test one representative application route and store its configuration with the artifact. A screenshot without its command context is difficult to reproduce after the site or tool changes.

Credential and destination safety

Local login is convenient on a trusted workstation. In CI, inject SNAPSHOT_SITE_API_KEY from the platform secret store and ensure the job does not echo environment variables. Pull requests from untrusted forks should not receive production credentials.

Validate or preselect the target URLs a script is allowed to capture. Avoid passing arbitrary user input from a shell or workflow event directly to a network service. Signed preview tokens and private result URLs should also be redacted from general logs.

Reliable CI usage

Pin or deliberately update the CLI version, bound concurrency, classify failures, and cap retry. A validation or authentication error needs correction; a transient rate or service condition may justify delayed retry. Save JSON output for diagnostics while keeping sensitive values out of published artifacts.

For larger batches, use a durable job identity so rerunning a workflow does not create unexplained duplicates. Store the source or deployment identifier, viewport, CLI version, capture time, and review outcome with the generated file.

Use the authentication guide before adding secrets to CI and the error handling guide before automating retries.

Screenshot API CLI FAQ

What can the Snapshot Site CLI do?

It runs screenshot, rendered-page analysis, and visual comparison commands, and can save structured responses and returned assets for local or CI use.

How should the CLI authenticate in CI?

Inject SNAPSHOT_SITE_API_KEY from the CI secret store into a protected job. Do not write a production credential into the repository, workflow output, or cached artifacts.

Is snapshot-site login suitable for CI?

Use environment-based secret injection for ephemeral CI runners. The login command is more convenient for a trusted local workstation with protected configuration.

Can the CLI capture localhost?

The hosted renderer needs a reachable HTTP or HTTPS target. Capture an authorized preview deployment, or use a local browser tool for a page available only on your machine.

Should a large batch run as one shell loop?

Small bounded batches can. For large workloads, add controlled concurrency, retry classification, progress state, and idempotency instead of launching an unbounded loop.

How do I preserve reproducible CLI results?

Save the command options, CLI version, target or deployment identity, viewport, capture time, JSON response, and downloaded artifact together.

Can the CLI replace Playwright?

Use the CLI for result-oriented capture, analysis, and comparison. Use Playwright when the workflow must click, type, authenticate interactively, or assert browser behavior.

Where should downloaded files be stored?

Place them in application or CI storage with access, retention, and deletion rules appropriate to the source page. Avoid publishing private evidence as a public artifact.

Run one reproducible CLI capture

Start with an authorized public fixture, explicit viewport, and protected credential before moving the command into CI.