Commands#

The complete command surface. Every command takes --json (print the JSON payload to stdout); without it the human view is printed. Global options (session, naming, network, downloads, post-processing) precede the command and apply to it — the global options tables are on the front page.

The batch verbs (resolve-many, plan-many, download-many) accept, besides plain links, @FILE (a link-list file: one link per line — CRLF endings included — commas/whitespace, #/[/{ comments, nested list files in the same directory) and - (the link list on stdin, at most one per invocation):

$ btdl download-many @watchlist.txt
$ btdl search-all "daft punk" --json | jq -r '.items[].link' | btdl plan-many -

The @file contents (nesting, containment, the 8 MiB/50 000-link caps) expand via the library’s tidalpy.links.parse_link_list; duplicates are dropped across the WHOLE expansion — @file links and bare links alike, first occurrence’s position winning. A list file that cannot be read, or an expansion that yields no links, is a usage error (exit 2); over a cap is a typed error (exit 1) — all fail fast, before any request.

$ btdl --help

Catalog lookups#

Command

What it does

btdl resolve URL

Resolve a Tidal link to its catalog resource — web-app deep links (query strings), the www host form and a scheme-less form are normalised (the row’s link is the clean canonical form)

btdl metadata URL

The raw metadata payload for a link ({"type", "data"})

btdl resolve-many URL [URL ...] [@FILE | -]

Resolve a batch; each row is ok or code+reason (never aborts on one bad link)

btdl tracks URL

The tracks of an album, playlist, or artist

btdl artwork ITEM --out FILE [--size 1280]

Fetch an item’s artwork bytes to a file (the default 1280 is re-parsed to 640 for playlist/mix items — the CDN refuses playlist art at 1280; an explicit --size is left alone; missing parent directories are created)

btdl artwork-url ARTWORK_ID [--width 1280] [--height 1280]

The CDN URL for a raw artwork id (offline — no network)

btdl lyrics URL

{"lyrics", "subtitles"} for a track (empty strings when none)

btdl credits URL

An album’s credits (roles + contributors)

btdl contributors URL

A track’s contributors

btdl radio URL [--limit 50]

The radio tracks seeded from a link

btdl atmos URL

The Dolby Atmos twin of an album or track (a miss prints, and JSON gives null)

btdl video URL

Video details for a link

btdl invalidate

Drop the client’s caches (pure local)

The resolve gate takes the audio catalog’s kinds (track, album, playlist, mix, artist): a video link is refused fail-fast (zero traffic — btdl video is the verb that takes them), and a link of an unknown kind (say, tidal.com/user/…) is walked as a bare id and fails with the typed not-found (exit 1) — in download-many that link instead earns its failed report row (code: not-found), per the batch isolation contract. Paging parameters outside the API’s range are clamped on the wire (the library’s windows): --limit to 1..50 (0 → 1, 999 → 50), --offset to ≥ 0. An empty or blank query short-circuits locally: an empty result, zero traffic.

Artist & album groups#

$ btdl artist albums URL [--include-ep/--no-include-ep]   # the discography (EPs on by default)
$ btdl artist tracks URL [--include-ep/--no-include-ep]
$ btdl artist top URL [--limit 20]
$ btdl artist similar URL [--limit 10]
$ btdl artist videos URL [--limit 50] [--offset 0]

$ btdl album similar URL [--limit 10]
$ btdl album credits URL

Track#

Command

What it does

btdl playback URL [--preview]

What will actually be played: delivered quality, codec, rate/depth, preview flag, the stream URL — and, when the ask isn’t met, the fallbackReason that says why the delivery is lower

btdl playback-many ID [ID ...] [--preview]

The same, batched (queue pre-flight; rows are the facade’s snake_case) — track ids only: a link is a usage error (btdl playback is the link verb)

btdl by-isrc ISRC

The track an ISRC belongs to (a miss is a clean miss, not an error)

Download family#

Downloads render progress on stderr and install a SIGINT handler: one Ctrl-C cancels gracefully (btdl: cancelling (Ctrl-C again to abort)), a second aborts. A cancelled run exits 130 after emitting its report.

Command

What it does

btdl download URL [--dest DIR] [--workers 4] [--preview] [--retag] [--fail-fast]

Download a track/album/playlist/mix/artist (missing --dest directories are created). Resume (.part promotion), skip-existing, quality-downgrade chain, per-item isolation; the report is the payload

btdl download-many URL [URL ...] [@FILE | -] [--dest DIR] [--workers 4] [--preview] [--retag] [--fail-fast]

A batch: one report per URL, a bad URL never sinks the run (missing --dest directories are created, as for download)

btdl list URL [--deep]

The item report (broken items + reasons); --deep resolves every stream — the rows carry the resolved quality/codec and the naming template’s intended path, without downloading

btdl plan URL [--dest DIR] [--preview]

What a download would do, as a fact (download_count / skip_count / video_count + per-item rows) — no stream spent

btdl plan-many URL [URL ...] [@FILE | -] [--dest DIR] [--preview]

The same, batched — a URL that cannot be planned earns a failed row (ok false, code + reason), named as such in the human view

btdl check FILE URL [--preview] [--verify]

Does a local file already satisfy a download of the link?

btdl retag URL [--dest DIR] [--workers 4]

The download run’s re-tag mode: already-downloaded files are re-tagged in place (no re-download), missing files deliver

--dest overrides the global --output for one run; --quality overrides the global quality. The JSON report is the library’s DownloadReport (ok, items[] with per-item status ok|failed|skipped, reason, path, …) — and when a quality-downgrade chain lands below the ask, each item carries delivered_quality plus the fallback_reason that says why. The per-item code names the layer that failed: not-found (the resolve gate), unsupported-type (a rejected kind, e.g. a video link in a batch), api (a catalog rejection), region-locked (the policy outcome), preview-only (the 30 seconds are all there is and --preview was not given), download (the bytes themselves — say, a media URL that 404s after the playback resolved).

download-many returns one row per URL — and every row is a full DownloadReport, a link that fails to resolve included (ok is false, items[0] a failed row carrying the resolve error’s code/reason); in the human view each URL gets its report: N ok, M failed, K skipped summary line, in input order.

An account that isn’t entitled to the requested quality (a 403 CLIENT_NOT_ENTITLED from the playback endpoint) fails the item with code api (the playback verb: a typed error, exit 1); the block is cached per quality for the TTL window, so later items in the same run never re-probe the refused quality. A region-locked asset (a 403 saying the content is not available in your country) is a policy outcome no rung lifts: the item carries code region-locked, and the playback verb (or a region-locked catalog row) fails with the typed error, exit 1.

An unresolvable link fails at the resolve gate, before any download: a typed error (exit 1), no report — the same with and without --fail-fast. --fail-fast governs item-level failures: without it (the skip-broken default) a broken item becomes a failed row and the run continues (exit 0, the report carries the failure); with it (or the global --no-skip-broken) the run stops after the first failure — the report comes back ok: false with the following items skipped (reason: "aborted: previous item failed"). In download-many the per-URL isolation contract holds either way — a dead or broken URL earns its failed report row and never sinks the run; --fail-fast only reaches within each URL’s own download. The single-track verbs (stream, playback, check) never receive a collection: a collection link is refused at the resolve gate (… requires a single track; got a album link, exit 1) before any playback request is spent.

The preview seam runs through the family: --preview accepts the ~30 s preview where the catalog cannot deliver the full track (free tier, pre-release, exclusive). A preview delivery is a delivery — the file lands under its (preview)-suffixed name (02 Artist - Track 12 (preview).flac), its receipt records preview: true, and the report row is ok. Without the flag the same track is a failed row with code preview-only — the deep list shows it there too, the report’s broken-item contract. The superset rule runs both directions: a full file satisfies a --preview request, and a (preview) file satisfies one too — plan --preview over a preview-delivered tree skips every row, while plan without the flag still wants the full track (a (preview) file never satisfies a full request). plan --preview cannot tell which tracks will turn out preview-only without spending playback, so its candidate doubling is request-level: every item’s candidates cover both name spaces (the full names first, then the (preview) variants).

check answers with the receipt check’s machine code — satisfied plus the reason a host keys off. Satisfied: complete, with the verdict’s proof level in verified ("fingerprint", escalated to "sha256" when --verify re-hashes the whole file against the receipt). Unsatisfied: no-receipt (a downloaded file is only a skip candidate, not a proof), wrong-track (the receipt names a different track), preview-mismatch (a full request meets a ~30 s preview delivery — a --preview request satisfies on its own preview receipt or on any full delivery, the superset rule), incomplete (never fully post-processed — the retag seam’s trigger), lower-quality (the upgrade path), file-missing, empty-file, file-changed (size/mtime/ fingerprint no longer match), or content-mismatch (the --verify proof: the full-file hash disagrees). When a receipt exists, its recorded facts ride along (recorded_quality, recorded_codec, metadata_complete, recorded_preview).

The write commands (download, download-many, retag, iter-streams) take the library’s output directory lock for the life of the run: one dotfile (.tidalpy.lock) in the destination tree marks the holder (pid, host, purpose), so a second btdl writing the same tree waits up to --output-lock-timeout seconds (then fails with a retryable error) instead of corrupting each other’s .part/receipt state. The same process re-enters its own lock freely.

Stream#

Command

What it does

btdl stream URL [--out FILE] [--preview] [--chunk-size N]

A track’s plaintext bytes — to stdout when --out is omitted (pipe to ffplay, sox, …; unlike artwork, --out does not create missing parent directories)

btdl iter-streams URL --dest DIR [--chunk-size N] [--preview]

Stream a collection’s tracks to files, one NNN - <title>.bin per track (unlike stream --out, a missing --dest is created); a broken track is skipped (the --skip-broken default) or fails the run with its error; --preview accepts the ~30 s clip where no full stream exists

btdl stream --json requires --out (binary and JSON can’t share stdout) — without it the command is a usage error (exit 2).

User#

Command

What it does

btdl user profile [USER_ID]

A user’s profile (self when omitted)

btdl user playlists [USER_ID] [--limit 25] [--offset 0]

A user’s playlists

btdl user liked-tracks [USER_ID] [--limit 50] [--offset 0]

Liked tracks

btdl user liked-albums [USER_ID] [--limit 50] [--offset 0]

Liked albums

btdl user liked-artists [USER_ID] [--limit 50] [--offset 0]

Liked artists

Ids#

Raw catalog ids, ISRCs and UPCs — no link to resolve:

$ btdl ids tracks 123456 789        # one or more ids per command
$ btdl ids albums 123456
$ btdl ids artists 123456
$ btdl ids playlists 123456
$ btdl ids album-by-upc 1234567890128
$ btdl ids albums-by-upcs 1234567890128 ...
$ btdl ids tracks-by-isrcs USUM71000001 ...

The ids are the catalog’s own (legacy numeric or web-app form); ids the catalog does not know are skipped in the result, not fabricated — diff the result against the request for the gaps.

Auth#

See login: auth (bare = status, the human view — the JSON shape is auth status’s), auth status, auth token, auth ping, auth subscription, auth login, auth device-login, auth logout, auth rate-limit, auth clients, auth refresh, auth clear.

Command

What it does

btdl auth refresh

Proactively rotate the access token now (single-flight). A pasted web token has no refresh token (and a rejected rotation leaves the saved record untouched): it still exits 0 either way

btdl auth clear

Drop the saved login locally only (no remote revocation) — “log out of this machine” for account switches and token-file rotation (auth logout also posts /v1/logout)

Maintain#

Local media maintenance — all of these are offline (ffmpeg needed for transcode and probe):

Command

What it does

`btdl maintain transcode SRC DST [–preset P] [–format F] [–bitrate KBPS] [–bit-depth 16

24] [–sample-rate HZ] [–timeout S]`

btdl maintain presets

The CDJ encoder preset table and supported target formats (offline)

btdl maintain probe FILE

The ffprobe facts of a local file

btdl maintain purge [--dest DIR] [--older-than SECONDS]

Remove incomplete (.part) files

btdl maintain diagnose

The structured self-check: output dir, ffmpeg, ffprobe, token, client — local, no network

Offline reference#

Command

What it does

btdl qualities

The quality profiles, the known --quality labels, and the built-in playback ladders (what the client tries, in order, per profile) — pure local