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
Search#
Command |
What it does |
|---|---|
|
One page of catalog search results ( |
|
Page through until the query is exhausted (payload adds |
|
Album search with artist-name-aware logic: when the query is a catalog artist’s name, its discography is listed first, followed by the title-matching albums (deduplicated by id) |
|
Search suggestions (uniform search rows); |
|
The catalog’s genre list |
|
Browse the items of a genre ( |
Search rows carry kind, id, title plus the kind-specific
fields (artists, duration, quality, link, …); --json
returns the library’s wrapper dict (text, type, total,
items, and top_hit when the catalog names a best match — the
paged search-all wrapper carries it from the first page).
Catalog lookups#
Command |
What it does |
|---|---|
|
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) |
|
The raw metadata payload for a link ( |
|
Resolve a batch; each row is |
|
The tracks of an album, playlist, or artist |
|
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 |
|
The CDN URL for a raw artwork id (offline — no network) |
|
|
|
An album’s credits (roles + contributors) |
|
A track’s contributors |
|
The radio tracks seeded from a link |
|
The Dolby Atmos twin of an album or track (a miss prints, and JSON gives |
|
Video details for a link |
|
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 |
|---|---|
|
What will actually be played: delivered quality, codec, rate/depth, preview flag, the stream URL — and, when the ask isn’t met, the |
|
The same, batched (queue pre-flight; rows are the facade’s snake_case) — track ids only: a link is a usage error ( |
|
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 |
|---|---|
|
Download a track/album/playlist/mix/artist (missing |
|
A batch: one report per URL, a bad URL never sinks the run (missing |
|
The item report (broken items + reasons); |
|
What a download would do, as a fact ( |
|
The same, batched — a URL that cannot be planned earns a failed row ( |
|
Does a local file already satisfy a download of the link? |
|
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 |
|---|---|
|
A track’s plaintext bytes — to stdout when |
|
Stream a collection’s tracks to files, one |
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 |
|---|---|
|
A user’s profile (self when omitted) |
|
A user’s playlists |
|
Liked tracks |
|
Liked albums |
|
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 |
|---|---|
|
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 |
|
Drop the saved login locally only (no remote revocation) — “log out of this machine” for account switches and token-file rotation ( |
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]` |
|
The CDJ encoder preset table and supported target formats (offline) |
|
The ffprobe facts of a local file |
|
Remove incomplete ( |
|
The structured self-check: output dir, ffmpeg, ffprobe, token, client — local, no network |
Offline reference#
Command |
What it does |
|---|---|
|
The quality profiles, the known |