Skip to content

Command-line client

samplecloud is a small command-line client of the public API. It signs in with the device flow, searches the catalog, adds packs and sounds to your library, downloads them and keeps a folder on your disk in sync with the library. It is also a working example of the sync flow for anyone building a desktop app or plugin.

It needs Node.js 24 or newer and has no other dependencies. From the repository:

Terminal window
npm ci
npm run build -w @samplecloud/cli
node apps/cli/dist/main.js --help
# or put `samplecloud` on the PATH
npm install -g ./apps/cli
samplecloud --help
Terminal window
samplecloud login
To sign in, open https://sample.cloud/device
and enter the code: NQJV-VMVP
(or open https://sample.cloud/device?user_code=NQJV-VMVP)
The code is valid for 10 minutes. Waiting for approval… (Ctrl+C to cancel)
Signed in as Ada (@ada).

The browser opens by itself when the command runs in a terminal (--no-browser turns that off). You can approve the code on any device, even a phone. The app asks for profile:read, catalog:read, library:read, library:write and downloads; it shows up as a signed-in app on your account page, where you can sign it out.

Tokens are kept in a file readable only by you:

System Folder
Windows %APPDATA%\samplecloud
macOS ~/Library/Application Support/samplecloud
Linux $XDG_CONFIG_HOME/samplecloud (~/.config/samplecloud)

The access token lives an hour and is renewed on its own with the refresh token.

Terminal window
samplecloud whoami # who you are signed in as
samplecloud logout # ends the sign-in on the server and deletes the tokens

For scripts and CI, a personal access token works too: either samplecloud login --with-token < token.txt, or the SAMPLECLOUD_TOKEN environment variable, which wins over a stored sign-in.

Command What it does
samplecloud search <text> [filters] search sounds, programs and presets
samplecloud get <pack or sound> [--accept-terms] add it to your library
samplecloud download <pack or sound> [--to dir] download it once
samplecloud sync <dir> [--dry-run] [--verify] keep a folder equal to your library
samplecloud library [--type pack|asset] [--revoked] what you hold
samplecloud favorites [--type pack|asset] your favorites
samplecloud collections [<id>] your collections, or the items of one
samplecloud login, logout, whoami sign-in

A pack or sound can be named by its ID (pck_…, ast_…), by a pack slug (big-rusty-drums) or by its page URL (https://sample.cloud/packs/big-rusty-drums).

Global options: --json for machine-readable output, -v to log requests, and --api <url> (or SAMPLECLOUD_API) to talk to another server than https://api.sample.cloud.

Terminal window
samplecloud search kick
samplecloud search "dusty keys" --bpm 80-100 --key Am --kind sample
samplecloud search --instrument drums/kick --type one_shot --limit 50
samplecloud search --kind preset --json

Filters map to the search parameters: --kind, --instrument, --genre, --mood, --bpm (90, 80-100, 80- or -100), --key, --type loop|one_shot, --pack <slug>, --sort, --limit (up to 100).

Terminal window
samplecloud get big-rusty-drums
samplecloud download big-rusty-drums --to ~/Samples/Drums

The first time you get something, you have to accept the terms of use. get prints the link and asks you to run it again with --accept-terms.

download asks for the pack’s manifest and fetches its files four at a time. Without --to, a pack goes into a folder named after it in the current folder and a sound into the current folder. Every file is written to <name>.part first and renamed only after its size and SHA-256 match the manifest, so an interrupted download never leaves a broken file. Files already there with the right hash are skipped, so running the command again finishes an interrupted download. Paths that would end up outside the target folder are refused.

Terminal window
samplecloud sync ~/Samples/sample.cloud
samplecloud sync ~/Samples/sample.cloud --dry-run

The folder gets one subfolder per pack (Big Rusty Drums/…, in the pack’s own layout) and single sounds under Sounds/<pack title>/…. A single sound from a pack you also hold is not downloaded twice.

The first run takes the current position of the change feed, lists your library and downloads everything. Later runs read only the changes since then:

  • something new in the library: downloaded;
  • a pack whose contents changed: its manifest is compared with the files on disk; new and changed files are downloaded, files that left the pack are moved to the trash;
  • something you no longer hold: its files are moved to the trash.

Nothing is deleted. The trash is <dir>/.samplecloud/trash/<date-time>/; empty it yourself. A file at a pack’s path that the client did not write (or that you changed) is also moved to the trash before the pack’s version is downloaded.

The state is in <dir>/.samplecloud/state.json: the change-feed cursor, what you hold, and the SHA-256 of every file the client wrote. The cursor moves only after a run without errors, so running sync again retries whatever failed. One folder syncs with one server; a lock file stops two syncs of the same folder at once.

Option Meaning
--dry-run print what would be added, re-checked or removed, and change nothing
--verify ask for every manifest again and hash every file on disk; repairs files deleted or changed by hand
--json print a report: plan, counts, failed files

A dry run doesn’t ask for manifests (each request for one counts as a download), so it shows packs, not single files.

The client sends an Idempotency-Key with POST /v1/acquisitions, waits out 429 answers as Retry-After says, and asks for a fresh manifest when download links expire. API errors are printed from the problem details with their request ID, for example samplecloud: Not Found (404) [req_01M8YX…]. The exit code is 0 on success, 1 on errors and 2 on wrong usage.