Orshot CLI
Generate visuals from your terminal with the Orshot command-line interface
NPM Package: https://www.npmjs.com/package/orshot-cli
Video Tutorial
Introduction
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.
Features
- Template Management: List and discover available library and studio templates
- Image Generation: Generate images from both library and studio templates
- Multiple Output Formats: Support for PNG, JPG, JPEG, WebP, and PDF
- Flexible Response Types: Get images as base64 data, binary files, or download URLs
- Interactive Mode: Guided template modification setup
- Batch Processing: Generate multiple variations with different modifications
- Cross-Platform: Works on macOS, Linux, and Windows
Installation
Install the CLI globally using npm:
Getting Started
1. Authentication
First, obtain your API key from Orshot Workspace > Settings > API Key, then authenticate:
You can also run the command without the API key to be prompted securely:
2. Verify Authentication
Check your authentication status:
3. Discover Templates
List your available templates:
4. Generate Your First Image
Generate an image from a template:
Commands Reference
Authentication Commands
orshot auth login [api-key]- Log in with your API keyorshot auth logout- Log out and clear credentialsorshot auth whoami- Show current user information
Template Commands
orshot templates library- List library templatesorshot templates studio- List studio templatesorshot templates modifications <template-id>- Show available modifications
Generation Commands
orshot generate library <template-id>- Generate from library templateorshot generate studio <template-id>- Generate from studio template
Common Options
Generation Options
-m, --modification <key=value>- Template modifications (repeatable)-f, --format <format>- Output format: png, jpg, jpeg, webp, pdf-t, --type <type>- Response type: base64, binary, url-o, --output <filename>- Custom output filename-i, --interactive- Interactive modification mode-j, --json- Output response as JSON
Template Options
-l, --limit <number>- Limit number of results-j, --json- Output as JSON-t, --type <type>- Template type: library or studio
Usage Examples
Basic Workflow
Interactive Mode
For templates with many modifications, use interactive mode:
This will guide you through setting up modifications step by step.
Batch Processing
Generate multiple variations:
Different Output Formats
Studio Templates
Studio templates work the same way as library templates:
Configuration
The CLI stores configuration in your system's config directory:
- macOS:
~/Library/Preferences/orshot-cli/config.json - Linux:
~/.config/orshot-cli/config.json - Windows:
%APPDATA%/orshot-cli/config.json
Troubleshooting
Common Issues
Authentication Error:
Solution: Run the login command with your API key.
Template Not Found:
Solution: Verify the template ID and ensure you have access to it.
Invalid API Key:
Solution: Double-check your API key from the Orshot dashboard.
Getting Help
Use the --help flag with any command for detailed usage information:
Integration with Scripts
The CLI is perfect for automation and scripting:
The CLI supports JSON output for programmatic use: