Package Download
There are two basic ways to download a package from a Cloudsmith repository:
- via a native package manager
- via the Website UI
You cannot download a package directly using the API or CLI. However, you can use the API to obtain a URL that you can then use to download a package.
See the full API documentation, including an interactive sandbox environment for you to test your API requests.
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:

Select to Push/Pull a package
This will bring you to a window with a list of all supported package manager formats:

Setup guides for native package managers
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:

Setup guide for Ruby packages
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:

Setup Tab on Package Detail page
There you are presented with contextual instructions for how to use a package:

Instructions for using a package
Download via Website UI
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:

Download buttons on packages list (public repository)

Download button on package detail page (public repository)
Private Repositories
Downloading packages from a private repository is a little different. Click the download button.

Download buttons on repository packages list (private repository)
You will be prompted to enter an Entitlement token:

Download buttons on repository packages list (private repository)
See Entitlements and Sharing a Private Package for more details on Entitlement Tokens.
Bulk Package Download
You cannot bulk download packages using the Website UI, but you can do it with a little scripting using the Cloudsmith CLI. The Cloudsmith CLI is Python-based, so it needs Python (2 or 3) installed, and is available via pip
(pip install cloudsmith-cli
).
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
done
account="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
done
These 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/<organization>/<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 (Powershell 3.0)
Please ensure that you have added the Python scripts directory your PATH (when you install via pip
it will tell you what the path is) and also that you've got your API key from https://cloudsmith.io/user/settings/api/ 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)
}
Updated 11 days ago