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:

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:


Update Track

Edits one track. The body is a TrackEdit, and every field in it is optional:

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:

Parameters:

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:

Parameters:

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.

Details:

Parameters:

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:

Parameters:

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.

Details:

Parameters:

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:

Parameters:

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:

Example Request:

curl -X POST "https://your-api-url.com/api/update/jobs/retry" \
     -H "Authorization: Bearer <JWT-token>"