NPM Package: https://www.npmjs.com/package/orshot-cli
The Orshot CLI is a command-line interface that allows you to generate dynamic images from your Orshot templates directly from your terminal. Perfect for automation, scripting, and integrating image generation into your development workflow.
Install the CLI globally using npm:
npm install -g orshot-cliFirst, obtain your API key from Orshot Workspace > Settings > API Key, then authenticate:
orshot auth login <your-api-key>You can also run the command without the API key to be prompted securely:
orshot auth loginCheck your authentication status:
orshot auth whoamiList your available templates:
# List library templates
orshot templates library
# List studio templates
orshot templates studioGenerate an image from a template:
# Basic generation
orshot generate library website-screenshot
# Generate with custom modifications
orshot generate library website-screenshot -m websiteUrl="https://example.com"
# Interactive mode for guided setup
orshot generate library website-screenshot --interactiveorshot auth login [api-key] - Log in with your API keyorshot auth logout - Log out and clear credentialsorshot auth whoami - Show current user informationorshot templates library - List library templatesorshot templates studio - List studio templatesorshot templates modifications <template-id> - Show available modificationsorshot generate library <template-id> - Generate from library templateorshot generate studio <template-id> - Generate from studio template-m, --modification <key=value> - Template modifications (repeatable)-f, --format <format> - Output format: png, jpg, webp, pdf, mp4, webm, gif-t, --type <type> - Response type: base64, binary, url-o, --output <filename> - Custom output filename-s, --scale <number> - Scale factor (e.g., 2 for 2x size)-p, --pages <numbers...> - Specific pages to render (e.g., 1 3 for multi-page templates)--dpi <number> - DPI for PDF output (default: 72)--quality <number> - Quality (1-100) for JPG/WebP/Video--video-loop - Set video output to loop--video-muted - Mute audio in video output--video-trim-start <seconds> - Trim video start time--video-trim-end <seconds> - Trim video end time--webhook <url> - Webhook URL for async notification-i, --interactive - Interactive modification mode-j, --json - Output response as JSON-l, --limit <number> - Limit number of results-j, --json - Output as JSON-t, --type <type> - Template type: library or studio# Authenticate
orshot auth login your-api-key
# List available templates
orshot templates library
# Generate with modifications
orshot generate library website-screenshot \
-m websiteUrl="https://github.com" \
-o github-screenshot.pngFor templates with many modifications, use interactive mode:
orshot generate library website-screenshot --interactiveThis will guide you through setting up modifications step by step.
Generate multiple variations:
orshot generate library website-screenshot -m websiteUrl="https://github.com" -o github.png
orshot generate library website-screenshot -m websiteUrl="https://stackoverflow.com" -o stackoverflow.png
orshot generate library website-screenshot -m websiteUrl="https://npmjs.com" -o npmjs.png# Generate PNG (default)
orshot generate library website-screenshot -m websiteUrl="https://example.com" -o website.png
# Generate JPG
orshot generate library website-screenshot -m websiteUrl="https://example.com" -f jpg -o website.jpg
# Generate PDF
orshot generate library website-screenshot -m websiteUrl="https://example.com" -f pdf -o website.pdf
# Get download URL instead of file
orshot generate library website-screenshot -m websiteUrl="https://example.com" -t urlGenerate MP4 videos or GIFs with trim and loop options:
# Generate a looping video
orshot generate studio video-template-123 -f mp4 --video-loop
# Generate a GIF trimmed to first 5 seconds
orshot generate studio video-template-123 -f gif --video-trim-start 0 --video-trim-end 5Generate PDF reports or specific page ranges:
# Generate high-quality PDF (300 DPI)
orshot generate studio report-template-456 -f pdf --dpi 300
# Generate only specific pages (1 and 3)
orshot generate studio multi-page-template-789 -f pdf --pages 1 3For long-running tasks like 4K video rendering, use webhooks:
orshot generate studio heavy-video-template \
-f mp4 \
--quality 100 \
--webhook "https://your-api.com/webhooks/orshot-callback"Studio templates work the same way as library templates:
# List studio templates
orshot templates studio
# Generate from studio template
orshot generate studio def456 -m name="John Doe" -m title="CEO"The CLI stores configuration in your system's config directory:
~/Library/Preferences/orshot-cli/config.json~/.config/orshot-cli/config.json%APPDATA%/orshot-cli/config.jsonAuthentication Error:
❌ Not authenticated. Please run:
orshot auth login <your-api-key>Solution: Run the login command with your API key.
Template Not Found:
❌ Failed to generate image: Template not found.Solution: Verify the template ID and ensure you have access to it.
Invalid API Key:
❌ Login failed: Invalid API key. Please check your credentials.Solution: Double-check your API key from the Orshot dashboard.
Use the --help flag with any command for detailed usage information:
orshot --help
orshot generate --help
orshot templates --helpThe CLI is perfect for automation and scripting:
#!/bin/bash
# Generate website screenshots for different sites
orshot generate library website-screenshot \
-m websiteUrl="https://github.com/$REPO_NAME" \
-o "github-${REPO_NAME}.png"
orshot generate library website-screenshot \
-m websiteUrl="https://docs.$DOMAIN.com" \
-o "docs-${DOMAIN}.png"The CLI supports JSON output for programmatic use:
# Get template list as JSON
templates=$(orshot templates library --json)
# Generate image and get response as JSON
response=$(orshot generate library website-screenshot -m websiteUrl="https://example.com" -j)