Metadata Updates APIs Documentation
The UpdateController lets admins fix tags that came in wrong: rename tracks, albums and artists,
move tracks between albums, and merge duplicates. Every change is also written into the audio files' tags, so
the next scan reads the same thing back instead of undoing it. How that works is in
Library Editing.
A few things that are true for every endpoint here:
- They all need the
Adminrole. - Only the fields you send change. Leave out anything you don't want touched.
- The database changes right away, so clients see the edit at once. The files are written in the background.
- While a library scan is running, edits are refused with
409. Try again when it's done.
Controller Route: /api/update
All routes within the UpdateController are prefixed by /api/update.
Summary of Endpoints
| Endpoint | Method | Description | Authorization |
|---|---|---|---|
/api/update/track |
PUT | Edits a track. | Admin |
/api/update/tracks |
PUT | Applies one edit to several tracks. | Admin |
/api/update/album |
PUT | Edits an album. | Admin |
/api/update/artist |
PUT | Edits an artist. | Admin |
/api/update/artist/merge |
POST | Merges artists into one. | Admin |
/api/update/album/merge |
POST | Merges albums into one. | Admin |
/api/update/jobs |
GET | Shows how the file writes for recent edits are going. | Admin |
/api/update/jobs/retry |
POST | Tries the files that couldn't be written again. | Admin |
What an Edit Returns
Every edit and merge returns an EditResult:
{
"EditId": "6650c0ffee...", // use this to find the edit in /api/update/jobs
"Files": 12, // how many files will get new tags
"Id": "66bc99b8ab...", // the document the edit ended on (a merge target, or the album a track moved to)
"Message": "Album updated."
}
Errors come back as a plain text message with the status code:
- 400 Bad Request: Something needed is missing, like a name, or there's nothing to merge.
- 404 Not Found: The track, album or artist (or one it points to) wasn't found.
- 409 Conflict: A library scan is running.
Update Track
Edits one track. The body is a TrackEdit, and every field in it is optional:
Name,Position,Disc,Year,ReleaseDate,ISRC,MusicBrainzID,TrackGenres,Chapters: set as sent.-
TrackArtists: a list of{ "_id": "..." }or{ "Name": "..." }. A name uses the artist that already has it (ignoring case), or makes a new one. -
Album:{ "_id": "..." }moves the track to that album.{ "Name": "..." }moves it to the album with that name and the track's album artists, and makes one if there isn't one. Albums left empty are removed. Ratings: only changes your own rating.
The old way, sending a whole ResponseTrack back, still works. It's read the same way, so anything you didn't change stays as it was.
Details:
- Endpoint:
/api/update/track - Method:
PUT - Authorization: JWT (Roles: Admin)
Parameters:
- id (string, required): The ID of the track.
- body (
TrackEdit, required): The fields to change.
Example Request:
curl -X PUT "https://your-api-url.com/api/update/track?id=66bc99b8ab7ba419497e21af" \
-H "Authorization: Bearer <JWT-token>" \
-H "Content-Type: application/json" \
-d '{ "Name": "Levels (Radio Edit)", "TrackArtists": [{ "Name": "Avicii" }], "Album": { "Name": "Levels" } }'
Update Several Tracks
Applies one edit to several tracks at once, like setting the artists or genres on a whole album, or moving a
handful of tracks to another album. It takes the same TrackEdit as above, except
Name, since several tracks can't share one name by accident.
Details:
- Endpoint:
/api/update/tracks - Method:
PUT - Authorization: JWT (Roles: Admin)
Parameters:
- body (required):
{ "Ids": [...], "Edit": TrackEdit }.
Example Request:
curl -X PUT "https://your-api-url.com/api/update/tracks" \
-H "Authorization: Bearer <JWT-token>" \
-H "Content-Type: application/json" \
-d '{ "Ids": ["66bc99b8ab7ba419497e21af", "66bc99b8ab7ba419497e21b0"], "Edit": { "TrackGenres": ["House"] } }'
Update Album
Edits an album. The body is an AlbumEdit: Name, Bio,
Publisher, ReleaseStatus, ReleaseType, ReleaseDate,
AlbumArtists, AlbumGenres and Ratings, all optional.
AlbumArtists takes ids or names, the same as a track's artists.
-
ReleaseDateandAlbumGenresare set on every track of the album, since a scan builds an album's date and genres from its tracks. - Renaming an album to the name and artists of another album puts them together, the same way a scan would. If their disc and track numbers clash (two copies of one release), they're linked as variants instead.
- Things only the scanner works out (track counts, variants, artwork) can't be set here.
Details:
- Endpoint:
/api/update/album - Method:
PUT - Authorization: JWT (Roles: Admin)
Parameters:
- id (string, required): The ID of the album.
- body (
AlbumEdit, required): The fields to change.
Example Request:
curl -X PUT "https://your-api-url.com/api/update/album?id=66bc99b8ab7ba419497e21af" \
-H "Authorization: Bearer <JWT-token>" \
-H "Content-Type: application/json" \
-d '{ "Name": "Baked", "AlbumArtists": [{ "Name": "Hotel Pools" }] }'
Update Artist
Edits an artist. The body is an ArtistEdit: Name, Bio,
Genres and Ratings, all optional.
Renaming an artist to a name another artist already has merges this one into it (see Merge). Only changing the case, like "JR JR" to "Jr Jr", is a plain rename.
Details:
- Endpoint:
/api/update/artist - Method:
PUT - Authorization: JWT (Roles: Admin)
Parameters:
- id (string, required): The ID of the artist.
- body (
ArtistEdit, required): The fields to change.
Example Request:
curl -X PUT "https://your-api-url.com/api/update/artist?id=66bc99b8ab7ba419497e21af" \
-H "Authorization: Bearer <JWT-token>" \
-H "Content-Type: application/json" \
-d '{ "Name": "Tyler, The Creator" }'
Merge Artists or Albums
Folds one or more duplicates into a target, then removes the duplicates. Use it when the same artist or album came in twice under different spellings.
- For artists, every credit moves to the target. For albums, every track does.
- Plays and skips add up per user.
- The target's ratings stay. A duplicate's rating only fills in for users who hadn't rated the target.
- Artwork and bios carry over where the target has none. An artist's genres are added to the target's.
- Play history moves to the target.
Details:
- Endpoints:
/api/update/artist/merge,/api/update/album/merge - Method:
POST - Authorization: JWT (Roles: Admin)
Parameters:
- body (required):
{ "TargetId": "...", "SourceIds": [...] }.
Example Request:
curl -X POST "https://your-api-url.com/api/update/artist/merge" \
-H "Authorization: Bearer <JWT-token>" \
-H "Content-Type: application/json" \
-d '{ "TargetId": "66bc99b8ab7ba419497e21af", "SourceIds": ["66bc99b8ab7ba419497e21b0"] }'
File Writes
Returns the latest edits, newest first, with how their file writes are going. Each one has
_id (the EditId), Description, CreatedUtc,
Files, and how many are Pending, Written and Failed.
Failures lists the files that couldn't be written, with the error (read-only, in use by another
program, a format that can't be tagged). A file is tried 3 times before it counts as failed. The database
keeps the edit either way.
Details:
- Endpoint:
/api/update/jobs - Method:
GET - Authorization: JWT (Roles: Admin)
Parameters:
- count (int, optional): How many edits to return, 1 to 200 (default is 25).
Example Request:
curl -X GET "https://your-api-url.com/api/update/jobs?count=10" \
-H "Authorization: Bearer <JWT-token>"
Retry Failed Writes
Puts every failed file back in line to be written. Fix whatever stopped it first (close the program holding the file, make it writable). Returns how many files were queued again.
Details:
- Endpoint:
/api/update/jobs/retry - Method:
POST - Authorization: JWT (Roles: Admin)
Example Request:
curl -X POST "https://your-api-url.com/api/update/jobs/retry" \
-H "Authorization: Bearer <JWT-token>"