Importing Existing Downloads into Lidarr
- Importing Existing Downloads into Lidarr
Importing Existing Downloads into Lidarr
Background
I keep my qBittorrent complete directory on my NAS (data/torrents/complete). When a download finishes, I want Lidarr to pick the album up and hard-link it into the library — no re-download, no duplicate data.
Lidarr 3.1 removed the old “Import Existing” command and the import-folders configuration entirely, which made the obvious paths dead ends. But the import pipeline still accepts an explicit path, so the whole thing is doable through the REST API. Here is the process, including the gotchas I hit.
1. Find the album’s internal ID
The album URL in the web UI uses the MusicBrainz UUID (foreignAlbumId), but the API uses the internal integer ID. They’re different — don’t paste the UUID from the URL into API calls.# List artists, find the internal artist ID
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/artist" \
| jq '.[] | select(.artistName | test("jony"; "i")) | {id, artistName}'
# List that artist's albums
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/album?artistId=557" \
| jq '.[] | {id, title, releaseDate}'
2. Check the copy mode first
In 3.1.x the media-management settings moved out of the old /config/import endpoint (which now returns 404) into /config/mediamanagement. The hard-link setting is copyUsingHardlinks:curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/config/mediamanagement" \
| jq '{copyUsingHardlinks, skipFreeSpaceCheckWhenImporting}'
# { "copyUsingHardlinks": true, ... }
With copyUsingHardlinks: true, import transfers use hard links (falling back to a real copy only if the filesystem can’t link — i.e. source and destination are on different filesystems).
3. Run the import
The command in 3.1.x is DownloadedAlbumsScan (the old ImportExistingCommand is gone). It takes the album folder’s absolute path as seen from inside the Lidarr container:curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"name": "DownloadedAlbumsScan",
"path": "/mnt/unas/data/torrents/complete/Jony - Список твоих мыслей (2019) [FLAC]",
"importMode": 0
}' \
"$LIDARR_URL/api/v1/command"
importMode is 0 = auto (follows copyUsingHardlinks), 1 = move, 2 = copy. Auto is what you want for hard links.
The response is a command object with an id and status: "started".
4. Verify
Poll the command, then confirm the tracks landed in the library:# Command result
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/command/791772" \
| jq '{status, result}'
# Album statistics
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/album/3982" \
| jq '.statistics'
# Track file paths
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/trackfile?albumId=3982" \
| jq '.[].path'
Finally, confirm they’re actually hard links (matching inodes, link count 2) from a shell on the NAS:ls -li '/mnt/unas/data/torrents/complete/Jony - Список твоих мыслей (2019) [FLAC]' \
'/mnt/unas/data/media/music/JONY (Russian artist)/Список твоих мыслей (2019)'
Since they’re hard links, deleting the complete/ folder afterwards is safe — the library keeps the data and nothing is freed on disk.
5. Importing a file that doesn’t match any track
The second album I imported had a 12th file — 12. Mayday (Bonus Track).flac — that didn’t belong to any track in the release, so the scan import left it behind (11/12). It turned out “Mayday” was actually its own EP release. Lidarr is organized around albums, so the fix was to add the EP as a separate album and import the bonus file into it as track 1.
Find the release in Lidarr’s metadata service
The Add Album dialog is backed by a public metadata API, which also includes releases that MusicBrainz doesn’t tie to a release group. I found the EP there and grabbed its ID:curl -sk "https://api.lidarr.audio/api/v0.4/search?type=album&query=Mayday&artist=Tinash%C3%A9" \
| jq '.[] | {id, title, type, releasedate}'
# { "id": "e3514e17-…", "title": "Mayday", "type": "EP", "releasedate": "2010-11-22" }
That id is the foreignAlbumId for the next step.
Add the EP as an album
POST /api/v1/album wants a full body — it 409s with NOT NULL constraint failed: Albums.Images when images is missing, and it needs the artist block too:curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"foreignAlbumId": "e3514e17-…",
"profileId": 1,
"monitored": true,
"artistId": 562,
"artist": {
"id": 562,
"foreignArtistId": "6567f19f-…",
"path": "/mnt/unas/data/media/music/Tinashé (male British singer-songwriter originally from Zimbabwe)",
"qualityProfileId": 1,
"metadataProfileId": 1
},
"images": []
}' \
"$LIDARR_URL/api/v1/album"
The new album comes with its release and tracks, all with internal IDs:curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/track?albumId=3987" \
| jq '.[] | {id, title, trackNumber}'
Import the file with an explicit track mapping
DownloadedAlbumsScan guesses the mapping from the folder; ManualImport takes it explicitly — one entry per file, with the exact track IDs:curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"name": "ManualImport",
"Files": [
{
"path": "/mnt/unas/data/torrents/complete/Tinashé - Saved (2010) [16Bit]/12. Mayday (Bonus Track).flac",
"artistId": 562,
"albumId": 3987,
"albumReleaseId": 26959,
"trackIds": [372856],
"quality": {
"quality": { "id": 6, "name": "FLAC" },
"revision": { "version": 1, "real": 0, "isRepack": false }
}
}
],
"importMode": 0,
"replaceExistingFiles": false
}' \
"$LIDARR_URL/api/v1/command"
One difference from DownloadedAlbumsScan: a ManualImport without a downloadId in auto mode does not hard-link. In the source, copyOnly resolves to downloadClientItem is { CanMoveFiles: false }, which is false for a null download-client item — so the file is moved (renamed) into the library instead. On my NAS both paths sit on the same mount, so it’s just an inode rename — no data duplication — but the copy in complete/ is consumed. If you want a hard link here, pass "importMode": 2 (copy), which goes through the copy path and honors copyUsingHardlinks.
Stop Lidarr from hunting the rest of the EP
The EP has four tracks and I only own one. Unmonitor the album so searches don’t chase the other three (a PUT also wants the full body, with monitored: false):curl -sk -X PUT -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '<full album body with "monitored": false>' \
"$LIDARR_URL/api/v1/album/3987"
The link can silently come undone. Sometime after the import — I noticed it after the unmonitor step — the track→trackfile link had been cleared: the track showed trackFileId: 0, hasFile: false and trackfile?albumId=3987 returned [], even though trackfile/{id} still returned the row and the file was fine on disk. Album/artist trackfile queries join through Track.TrackFileId, so a file with no linked track is invisible. Re-running the same ManualImport command fixed it: the file was now inside the artist path, so Lidarr took the existing-file branch — it deleted the orphaned row, re-added it, re-linked the track, and didn’t touch the file on disk.
Gotchas
- Old endpoint names 404.
/api/v1/config/import,/api/v1/config/root, etc. no longer exist in 3.1.x. The current endpoints (per the OpenAPI spec) are things like/api/v1/config/mediamanagementand/api/v1/config/host. - Command names drop the suffix.
CommandControllermatches names viaclassName.Replace("Command", ""), so sending"name": "DownloadedAlbumsScanCommand"returns a 500 (“Sequence contains no matching element”). Send"DownloadedAlbumsScan". - UI UUIDs are not API IDs.
/album/33f8a975-…in the browser is the MusicBrainz ID; the API’s/album/{id}wants the internal integer. - The
isAdmin: falseflag in/system/statusis a red herring. Lidarr has no user roles; it just reflects that authentication is enabled. A standard API key has full access. DELETE /api/v1/queue/{id}removes from the download client by default.removeFromClientdefaults totrue— for qBittorrent that’storrents/deletewithdeleteFiles, so the torrent and its files incomplete/are gone. Pass?removeFromClient=falseif you want to keep seeding.POST/PUT /api/v1/albumneeds a full body. Missingimages→ 409NOT NULL constraint failed: Albums.Images; aPUTwithoutforeignAlbumId(and the artist block) fails the same way. Fetch the album first and send it back with your changes.- Orphaned trackfiles vanish from album queries. If a track shows
hasFile: falsebut the file exists on disk, the track→trackfile link is probably broken. Re-running the sameManualImportfor that path re-links it without copying — the existing-file branch only replaces the DB row.
raw markdown
---
title: Importing Existing Downloads into Lidarr
date: 2026-11-25T21:30:00-0700
draft: false
description: Importing an album already downloaded with qBittorrent into Lidarr as hard links, using the v3.1 API.
status: complete
tags:
- linux
- media
- music
- guide
---
# Importing Existing Downloads into Lidarr
## Background
I keep my qBittorrent `complete` directory on my NAS (`data/torrents/complete`). When a download finishes, I want Lidarr to pick the album up and hard-link it into the library — no re-download, no duplicate data.
Lidarr 3.1 removed the old "Import Existing" command and the import-folders configuration entirely, which made the obvious paths dead ends. But the import pipeline still accepts an explicit path, so the whole thing is doable through the REST API. Here is the process, including the gotchas I hit.
## 1. Find the album's internal ID
The album URL in the web UI uses the MusicBrainz UUID (`foreignAlbumId`), but the API uses the internal integer ID. They're different — don't paste the UUID from the URL into API calls.
```sh
# List artists, find the internal artist ID
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/artist" \
| jq '.[] | select(.artistName | test("jony"; "i")) | {id, artistName}'
# List that artist's albums
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/album?artistId=557" \
| jq '.[] | {id, title, releaseDate}'
```
## 2. Check the copy mode first
In 3.1.x the media-management settings moved out of the old `/config/import` endpoint (which now returns 404) into `/config/mediamanagement`. The hard-link setting is `copyUsingHardlinks`:
```sh
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/config/mediamanagement" \
| jq '{copyUsingHardlinks, skipFreeSpaceCheckWhenImporting}'
# { "copyUsingHardlinks": true, ... }
```
With `copyUsingHardlinks: true`, import transfers use hard links (falling back to a real copy only if the filesystem can't link — i.e. source and destination are on different filesystems).
## 3. Run the import
The command in 3.1.x is `DownloadedAlbumsScan` (the old `ImportExistingCommand` is gone). It takes the album folder's absolute path **as seen from inside the Lidarr container**:
```sh
curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"name": "DownloadedAlbumsScan",
"path": "/mnt/unas/data/torrents/complete/Jony - Список твоих мыслей (2019) [FLAC]",
"importMode": 0
}' \
"$LIDARR_URL/api/v1/command"
```
`importMode` is `0` = auto (follows `copyUsingHardlinks`), `1` = move, `2` = copy. Auto is what you want for hard links.
The response is a command object with an `id` and `status: "started"`.
## 4. Verify
Poll the command, then confirm the tracks landed in the library:
```sh
# Command result
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/command/791772" \
| jq '{status, result}'
# Album statistics
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/album/3982" \
| jq '.statistics'
# Track file paths
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/trackfile?albumId=3982" \
| jq '.[].path'
```
Finally, confirm they're actually hard links (matching inodes, link count 2) from a shell on the NAS:
```sh
ls -li '/mnt/unas/data/torrents/complete/Jony - Список твоих мыслей (2019) [FLAC]' \
'/mnt/unas/data/media/music/JONY (Russian artist)/Список твоих мыслей (2019)'
```
Since they're hard links, deleting the `complete/` folder afterwards is safe — the library keeps the data and nothing is freed on disk.
## 5. Importing a file that doesn't match any track
The second album I imported had a 12th file — `12. Mayday (Bonus Track).flac` — that didn't belong to any track in the release, so the scan import left it behind (11/12). It turned out "Mayday" was actually its own EP release. Lidarr is organized around albums, so the fix was to add the EP as a separate album and import the bonus file into it as track 1.
### Find the release in Lidarr's metadata service
The Add Album dialog is backed by a public metadata API, which also includes releases that MusicBrainz doesn't tie to a release group. I found the EP there and grabbed its ID:
```sh
curl -sk "https://api.lidarr.audio/api/v0.4/search?type=album&query=Mayday&artist=Tinash%C3%A9" \
| jq '.[] | {id, title, type, releasedate}'
# { "id": "e3514e17-…", "title": "Mayday", "type": "EP", "releasedate": "2010-11-22" }
```
That `id` is the `foreignAlbumId` for the next step.
### Add the EP as an album
`POST /api/v1/album` wants a full body — it 409s with `NOT NULL constraint failed: Albums.Images` when `images` is missing, and it needs the artist block too:
```sh
curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"foreignAlbumId": "e3514e17-…",
"profileId": 1,
"monitored": true,
"artistId": 562,
"artist": {
"id": 562,
"foreignArtistId": "6567f19f-…",
"path": "/mnt/unas/data/media/music/Tinashé (male British singer-songwriter originally from Zimbabwe)",
"qualityProfileId": 1,
"metadataProfileId": 1
},
"images": []
}' \
"$LIDARR_URL/api/v1/album"
```
The new album comes with its release and tracks, all with internal IDs:
```sh
curl -sk -H "X-Api-Key: $API_KEY" "$LIDARR_URL/api/v1/track?albumId=3987" \
| jq '.[] | {id, title, trackNumber}'
```
### Import the file with an explicit track mapping
`DownloadedAlbumsScan` guesses the mapping from the folder; `ManualImport` takes it explicitly — one entry per file, with the exact track IDs:
```sh
curl -sk -X POST -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{
"name": "ManualImport",
"Files": [
{
"path": "/mnt/unas/data/torrents/complete/Tinashé - Saved (2010) [16Bit]/12. Mayday (Bonus Track).flac",
"artistId": 562,
"albumId": 3987,
"albumReleaseId": 26959,
"trackIds": [372856],
"quality": {
"quality": { "id": 6, "name": "FLAC" },
"revision": { "version": 1, "real": 0, "isRepack": false }
}
}
],
"importMode": 0,
"replaceExistingFiles": false
}' \
"$LIDARR_URL/api/v1/command"
```
One difference from `DownloadedAlbumsScan`: a `ManualImport` without a `downloadId` in auto mode does **not** hard-link. In the source, `copyOnly` resolves to `downloadClientItem is { CanMoveFiles: false }`, which is `false` for a null download-client item — so the file is **moved** (renamed) into the library instead. On my NAS both paths sit on the same mount, so it's just an inode rename — no data duplication — but the copy in `complete/` is consumed. If you want a hard link here, pass `"importMode": 2` (copy), which goes through the copy path and honors `copyUsingHardlinks`.
### Stop Lidarr from hunting the rest of the EP
The EP has four tracks and I only own one. Unmonitor the album so searches don't chase the other three (a `PUT` also wants the full body, with `monitored: false`):
```sh
curl -sk -X PUT -H "X-Api-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '<full album body with "monitored": false>' \
"$LIDARR_URL/api/v1/album/3987"
```
**The link can silently come undone.** Sometime after the import — I noticed it after the unmonitor step — the track→trackfile link had been cleared: the track showed `trackFileId: 0, hasFile: false` and `trackfile?albumId=3987` returned `[]`, even though `trackfile/{id}` still returned the row and the file was fine on disk. Album/artist trackfile queries join through `Track.TrackFileId`, so a file with no linked track is invisible. Re-running the same `ManualImport` command fixed it: the file was now inside the artist path, so Lidarr took the existing-file branch — it deleted the orphaned row, re-added it, re-linked the track, and didn't touch the file on disk.
## Gotchas
- **Old endpoint names 404.** `/api/v1/config/import`, `/api/v1/config/root`, etc. no longer exist in 3.1.x. The current endpoints (per the OpenAPI spec) are things like `/api/v1/config/mediamanagement` and `/api/v1/config/host`.
- **Command names drop the suffix.** `CommandController` matches names via `className.Replace("Command", "")`, so sending `"name": "DownloadedAlbumsScanCommand"` returns a 500 ("Sequence contains no matching element"). Send `"DownloadedAlbumsScan"`.
- **UI UUIDs are not API IDs.** `/album/33f8a975-…` in the browser is the MusicBrainz ID; the API's `/album/{id}` wants the internal integer.
- **The `isAdmin: false` flag in `/system/status` is a red herring.** Lidarr has no user roles; it just reflects that authentication is enabled. A standard API key has full access.
- **`DELETE /api/v1/queue/{id}` removes from the download client by default.** `removeFromClient` defaults to `true` — for qBittorrent that's `torrents/delete` with `deleteFiles`, so the torrent *and* its files in `complete/` are gone. Pass `?removeFromClient=false` if you want to keep seeding.
- **`POST`/`PUT /api/v1/album` needs a full body.** Missing `images` → 409 `NOT NULL constraint failed: Albums.Images`; a `PUT` without `foreignAlbumId` (and the artist block) fails the same way. Fetch the album first and send it back with your changes.
- **Orphaned trackfiles vanish from album queries.** If a track shows `hasFile: false` but the file exists on disk, the track→trackfile link is probably broken. Re-running the same `ManualImport` for that path re-links it without copying — the existing-file branch only replaces the DB row.
edit history: _posts/2026/11/lidarr_manual_import.md