Package Download
There are three basic ways to download a package from a Cloudsmith repository:
- Via a native package manager
- Via the Cloudsmith web app
- Via the Cloudsmith CLI
You cannot download a package directly using the Cloudsmith API. However, you can use the API to obtain a URL (cdn_url) that you can then use to download a package.
Download via Native Package Manager
Each repository contains context-aware documentation for setting up and downloading packages using the native package managers (such as apt, npm or gem for example). Click the "Push/Pull Packages" button:
This will bring you to a window with a list of all supported package manager formats:
For example, If you select "Ruby" from the window, you are then presented with the guide on how to Pull or Push a ruby package in this repository. Go to the Pull Package tab to learn how to download a ruby package from this repository:
The instructions for downloading and installing a package using a native package manager are available by pressing the "Use Package" button on any package detail page:
There you are presented with contextual instructions for how to use a package:
Download via Cloudsmith web app
You can download a package directly from the Cloudsmith Website.
Public Repositories
You can download any package from the packages list by clicking the expose more button on the right of the page, or by clicking the green "Download" button on a package detail page:
Private Repositories
Downloading packages from a private repository is a little different. Click the download button.
You will be prompted to enter an Entitlement token:
See Entitlements and Sharing a Private Package for more details on Entitlement Tokens.
Download via Cloudsmith CLI
You can download a package by using the cloudsmith download command:
cloudsmith download my-workspace/my-repo package-nameUseful flags
| Flag | Description |
|---|---|
--dry-run | Preview which files will be downloaded by a command. |
--outfile | Define a custom output directory for the download. |
--all-files | Download all associated package assets. For example, sources, javadoc, and SBOMs. |
--download-all | Download all matching packages where multiple packages share the same name or version. |
--version | Specify a package version to download. |
--tag | Filter by package tag. For example, latest, stable, or beta. |
--format | Filter by package format. |
--arch | Filter by package architecture. |
--os | Filter by package operating system (OS). |
--filename | Filter by filename. You can filter by exact filename, or by glob pattern. |
Examples
Download the latest version of a package:
cloudsmith download my-workspace/my-repo mypackageDownload to a specific directory:
cloudsmith download my-workspace/my-repo mypackage --outfile /tmp/myfiles/Download all associated package assets:
cloudsmith download my-workspace/my-repo mynugetpackage --all-filesFilter by package tag:
cloudsmith download my-workspace/my-repo package-name --tag latestFilter by format and architecture:
cloudsmith download my-workspace/my-repo package-name --format deb --arch amd64Filter by filename (exact or glob pattern):
cloudsmith download my-workspace/my-repo package-name --filename '*.nupkg'
cloudsmith download my-workspace/my-repo package-name --filename 'mypackage-1.0.0.nupkg'Download all matching packages where multiple packages share the same name/version:
cloudsmith download my-workspace/my-repo package-name --download-allCombine --download-all with --filename to download a subset of packages:
cloudsmith download my-workspace/my-repo package-name --download-all --filename '*.snupkg'For all available command options, see the cloudsmith download --help output.
Bulk Package Download
You cannot bulk download packages using the Cloudsmith web app, but you can do it with a little scripting using the Cloudsmith CLI. The Cloudsmith CLI ships as a standalone binary for Linux, macOS, and Windows, so no Python runtime is required. See Command-Line Interface for installation options.
The basic premise of these examples is that you use the Cloudsmith CLI to list the contents of the repository, extract the download URL for each package, and then download each package.
Linux Example (bash)
Please ensure that you have first set up the Cloudsmith CLI with your API key (or pass it to the cloudsmith command using the -k flag). See the CLI documentation for full details: Command-Line Interface
account="your-account"
repository="your-repo"
urls=$(cloudsmith ls pkgs $account/$repository -F json | jq -r '.data[].cdn_url')
for url in $urls; do
wget $url
doneaccount="your-account"
repository="your-repo"
token="your-entitlement-token"
urls=$(cloudsmith ls pkgs $account/$repository -F json | jq -r '.data[].cdn_url')
for url in $urls; do
wget --http-user=$account --http-password=$token $url
doneThese examples also use jq for filtering and processing the JSON returned by Cloudsmith CLI list packages (cloudsmith ls) command.
While using the cdn_url returned from the Cloudsmith CLI or API will work for downloading most packages, if you need to also download docker manifest files you can utilize a url in the following format to grab them : https://docker.cloudsmith.io/v2/<workspace>/<repository>/<package name>/manifests/<tag>
You can also add search queries to the command to limit what is downloaded, e.g:
To download files of version 1.0 only:
urls=$(cloudsmith ls pkgs $account/$repository -F json -q 'version:1.0' | jq -r '.data[].cdn_url')
To download npm packages only:
urls=$(cloudsmith ls pkgs $account/$repository -F json -q 'format:npm' | jq -r '.data[].cdn_url')
Windows example (Windows PowerShell 5.1 or PowerShell 7+)
Please ensure that you have added the Cloudsmith CLI directory to your PATH (the install script reports it as bin_dir) and also that you've got your API key from https://app.cloudsmith.com/settings/api-keys if the repository is private.
$account = "your-account"
$repository = "your-repository"
$key = "your-API-key"
$json = $(cloudsmith.exe ls pkgs $account/$repository -F json -k $key)
$urls = $json | ConvertFrom-Json | ForEach-Object { $_.data.cdn_url }
$wc = New-Object System.Net.WebClient
$creds = new-object System.Net.NetworkCredential("token", $key)
Foreach ($url in $urls) {
echo "Downloading $url ..."
$filename = [System.IO.Path]::GetFileName($url)
$cred_cache = new-object System.Net.CredentialCache
$cred_cache.Add($url, "Basic", $creds)
$wc.Credentials = $cred_cache
$wc.DownloadFile($url, $filename)
}