Using the Imgwire CLI
Use the Imgwire CLI when you want terminal access to Imgwire uploads, transformed CDN URLs, upload tokens, image records, metrics, CORS origins, and custom domain resources. It is useful for local workflows, scripts, CI jobs, static-site asset preparation, and AI agents that can run shell commands.
The CLI package is @imgwire/cli.
Install the CLI
Install it globally with npm:
npm install -g @imgwire/cli
Confirm the command is available:
imgwire --help
You can inspect any command with --help:
imgwire images upload --help
imgwire images url --help
Authenticate
Most CLI commands require a Server API Key. Create one in the Imgwire dashboard for the Environment you want to manage, then run:
imgwire login
Paste the Server API Key when prompted. Treat this key like a password because it can perform server-side API operations for that Environment.
For non-interactive environments, provide the key through IMGWIRE_API_KEY:
IMGWIRE_API_KEY=sk_live_... imgwire whoami
Useful auth commands:
imgwire whoami
imgwire logout
Do not run the CLI from browser code or public client bundles. Use it from trusted local machines, backend environments, or CI jobs.
Upload a local image
Upload an image from disk and print the new image ID:
imgwire images upload ./hero.png
Generate a CDN URL for the uploaded image:
imgwire images url img_123 --width 1200 --format auto --quality auto
You can also pipe upload output into URL generation:
imgwire images upload ./hero.png | imgwire images url --width 1200 --format auto --quality auto
Use this workflow for static-site images, docs screenshots, generated marketing assets, and local files you want to deliver through Imgwire.
Import an image from a URL
Use URL upload when another service already produced a public or temporary image URL. This is common with AI image generation services.
imgwire images upload-via-url https://assets.example.com/generated-hero.png --purpose "generated docs hero"
File name and MIME type are optional overrides:
imgwire images upload-via-url https://assets.example.com/generated-hero.png --filename generated-hero.png --mimetype image/png
After the image exists in Imgwire, generate the delivery URL you need:
imgwire images url img_123 --preset medium
Create upload tokens
When a frontend app uses signed uploads, your backend should issue upload tokens. The CLI can create a token while you are testing or scripting a backend workflow:
imgwire images create-upload-token
Use the Backend Quickstart for application code examples that issue upload tokens from a backend service.
Inspect and manage resources
List image records:
imgwire images list --limit 25 --page 1
Retrieve an image:
imgwire images get-image img_123
Create and inspect a bulk image download job:
imgwire images create-bulk-download-job --image-ids img_123,img_456
imgwire images get-bulk-download-job job_123
Fetch metrics:
imgwire metrics get-stats --interval hourly --tz UTC
imgwire metrics get-datasets --date-start 2026-05-01T00:00:00Z --date-end 2026-05-01T23:59:59Z --interval hourly --tz UTC
Manage CORS origins and custom domains:
imgwire cors-origin list
imgwire cors-origin create https://example.com
imgwire custom-domain get-custom-domain
imgwire custom-domain test-connection
Use the CLI with AI agents
AI coding agents can use the CLI for repeatable shell workflows. This is useful when an agent needs to upload a local docs screenshot, import a generated image URL, generate a transformed CDN URL, or inspect resources during a build or documentation task.
Prefer the Imgwire MCP Server when the agent can use OAuth-linked MCP tools. Use the CLI when you need a terminal-first workflow, a CI script, or a fallback for agents that cannot connect to remote MCP servers.
For best results, pair the CLI with the Imgwire Agent Skill so the agent has Imgwire-specific implementation rules before it runs commands.
Related pages
Last updated at: May 9, 2026