{ "info": { "description": "Two APIs: `/2.0/` is Last.fm (Audioscrobbler 2.0) compatible, for players and scrobblers; `/api/v1/` is the JSON API used by the web UI.", "title": "Scrobbler API", "version": "v1" }, "paths": { "/api/v1/auth/register": { "post": { "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "400": { "description": "Invalid username or password", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "409": { "description": "Username taken", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Token" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Register" } } } }, "summary": "Create an account", "description": "Registers a user and logs them in, returning a bearer token.", "tags": [ "Auth" ] } }, "/api/v1/auth/login": { "post": { "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "401": { "description": "Wrong username or password", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Token" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Login" } } } }, "summary": "Log in", "description": "Exchanges a username and password for a bearer token valid for 30 days.", "tags": [ "Auth" ] } }, "/api/v1/auth/logout": { "post": { "responses": { "204": { "description": "No Content" }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Log out", "description": "Revokes the bearer token used for this request.", "tags": [ "Auth" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/auth/me": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Current user", "tags": [ "Auth" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/apps": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ApiApp" } } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "List your API applications", "tags": [ "Apps" ], "security": [ { "bearerAuth": [] } ] }, "post": { "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiApp" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiAppCreate" } } } }, "summary": "Create an API application", "tags": [ "Apps" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/apps/{api_key}": { "delete": { "responses": { "404": { "description": "No such application", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "204": { "description": "No Content" }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Delete an API application", "description": "Also revokes every session issued to it.", "tags": [ "Apps" ], "security": [ { "bearerAuth": [] } ] }, "parameters": [ { "in": "path", "name": "api_key", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/api/v1/sessions": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Session" } } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "List client sessions", "tags": [ "Sessions" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/sessions/{session_id}": { "delete": { "responses": { "404": { "description": "No such session", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "204": { "description": "No Content" }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Revoke a client session", "description": "The client's session key stops working immediately (Last.fm error 9).", "tags": [ "Sessions" ], "security": [ { "bearerAuth": [] } ] }, "parameters": [ { "in": "path", "name": "session_id", "required": true, "schema": { "type": "integer", "minimum": 0 } } ] }, "/api/v1/tokens/{token}": { "get": { "responses": { "404": { "description": "Unknown or expired token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AuthTokenInfo" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Describe a token awaiting approval", "description": "Returns the name of the application asking for access.", "tags": [ "Tokens" ], "security": [ { "bearerAuth": [] } ] }, "parameters": [ { "in": "path", "name": "token", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/api/v1/tokens/approve": { "post": { "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "404": { "description": "Unknown or expired token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "204": { "description": "No Content" }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApproveToken" } } } }, "summary": "Approve a token", "description": "Grants the requesting application a session for your account once it calls\nauth.getSession.", "tags": [ "Tokens" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/now-playing": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NowPlaying" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "What you're listening to now", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/recent": { "get": { "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "required": false }, { "in": "query", "name": "limit", "schema": { "type": "integer", "default": 50, "minimum": 1, "maximum": 200 }, "required": false } ], "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RecentPage" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Recent scrobbles, newest first", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/top/artists": { "get": { "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "required": false }, { "in": "query", "name": "limit", "schema": { "type": "integer", "default": 50, "minimum": 1, "maximum": 200 }, "required": false }, { "in": "query", "name": "period", "schema": { "type": "string", "default": "7day", "enum": [ "overall", "7day", "1month", "3month", "6month", "12month" ] }, "required": false } ], "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TopPage" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Top artists over a period", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/top/albums": { "get": { "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "required": false }, { "in": "query", "name": "limit", "schema": { "type": "integer", "default": 50, "minimum": 1, "maximum": 200 }, "required": false }, { "in": "query", "name": "period", "schema": { "type": "string", "default": "7day", "enum": [ "overall", "7day", "1month", "3month", "6month", "12month" ] }, "required": false } ], "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TopPage" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Top albums over a period", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/top/tracks": { "get": { "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "required": false }, { "in": "query", "name": "limit", "schema": { "type": "integer", "default": 50, "minimum": 1, "maximum": 200 }, "required": false }, { "in": "query", "name": "period", "schema": { "type": "string", "default": "7day", "enum": [ "overall", "7day", "1month", "3month", "6month", "12month" ] }, "required": false } ], "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TopPage" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Top tracks over a period", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/counts": { "get": { "parameters": [ { "in": "query", "name": "period", "schema": { "type": "string", "default": "1month", "enum": [ "overall", "7day", "1month", "3month", "6month", "12month" ] }, "required": false }, { "in": "query", "name": "bucket", "schema": { "type": "string", "default": "day", "enum": [ "day", "week", "month" ] }, "required": false } ], "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Count" } } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Scrobbles per day, week or month", "description": "Day buckets include days with no scrobbles, so the series is continuous.", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/me/summary": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Summary" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Totals: scrobbles, distinct artists and tracks", "tags": [ "Stats" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/imports/options": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImportOptions" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "What can be imported", "description": "Pulling from Last.fm is only offered when the server has a Last.fm API key.", "tags": [ "Imports" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/imports/file": { "post": { "parameters": [ { "in": "query", "name": "format", "description": "Detected from the file name and contents when `auto`", "schema": { "type": "string", "default": "auto", "enum": [ "auto", "csv", "json" ] }, "required": false } ], "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "413": { "description": "File too large", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "400": { "description": "Empty or unsupported file", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "202": { "description": "Accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImportJob" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/ImportFile" } } } }, "summary": "Import an export file", "description": "Accepts lastfm-to-csv CSV files, other CSV/TSV files with a header row, and JSON\nexports of user.getRecentTracks pages. Files may be gzipped.", "tags": [ "Imports" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/imports/lastfm": { "post": { "responses": { "422": { "$ref": "#/components/responses/UNPROCESSABLE_CONTENT" }, "400": { "description": "Last.fm import isn't configured", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "202": { "description": "Accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImportJob" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LastfmImport" } } } }, "summary": "Import from Last.fm", "description": "Copies a Last.fm user's public scrobble history into your account.", "tags": [ "Imports" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/imports": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ImportJob" } } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Your recent imports", "tags": [ "Imports" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/imports/{job_id}": { "get": { "responses": { "404": { "description": "No such import", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImportJob" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "One import's progress", "tags": [ "Imports" ], "security": [ { "bearerAuth": [] } ] }, "parameters": [ { "in": "path", "name": "job_id", "required": true, "schema": { "type": "integer", "minimum": 0 } } ] }, "/api/v1/imports/{job_id}/cancel": { "post": { "responses": { "404": { "description": "No such import", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImportJob" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Cancel an import", "description": "Stops a waiting or running import. Scrobbles already imported are kept.", "tags": [ "Imports" ], "security": [ { "bearerAuth": [] } ] }, "parameters": [ { "in": "path", "name": "job_id", "required": true, "schema": { "type": "integer", "minimum": 0 } } ] }, "/healthz": { "get": { "responses": { "503": { "description": "The database is unreachable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Health" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Health check", "description": "Returns 200 when the API can reach its database.", "tags": [ "Health" ] } }, "/2.0/": { "get": { "tags": [ "Last.fm" ], "summary": "Call a Last.fm API method (query string)", "description": "Last.fm (Audioscrobbler 2.0) compatible API. Point a scrobbler's \"custom Last.fm\nserver\" setting at this server's `/2.0/`.\n\n**Signing.** Signed methods need `api_sig`: take every parameter except `format`,\n`callback` and `api_sig`, sort by name, concatenate each name followed by its\nvalue, append your application's shared secret, and take the md5 hex digest.\n\n**Sessions.** Methods that act as a user need `sk`, a session key from\n`auth.getMobileSession` or the desktop flow (`auth.getToken`, approval at\n`/api/auth/`, then `auth.getSession`).\n\n**Errors** use Last.fm's codes: 2 (Invalid service), 3 (Invalid Method), 4 (Authentication Failed), 6 (Invalid parameters), 8 (Operation failed), 9 (Invalid session key), 10 (Invalid API key), 13 (Invalid method signature supplied), 14 (Unauthorized Token), 15 (This token has expired), 29 (Rate limit exceeded).\n\n## Methods\n### `auth.getMobileSession`\n\nCreate a session key from a username and password.\n\n*Requires:* signed.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `username` | yes | Username |\n| `password` | yes | Password (send over HTTPS, as a POST body) |\n\nThe legacy `authToken` (md5 of username + md5(password)) form is not supported, because it requires storing unsalted password hashes. Clients that only support it (such as pylast's `password_hash`) should use the desktop flow instead.\n\n### `auth.getSession`\n\nExchange an approved token for a session key (desktop auth flow, step 3).\n\n*Requires:* signed.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `token` | yes | Token from auth.getToken, approved by the user |\n\n### `auth.getToken`\n\nFetch an unapproved request token (desktop auth flow, step 1).\n\n*Requires:* signed.\n\nSend the user to `/api/auth/?api_key=…&token=…` to approve the token, then call auth.getSession. Tokens expire after 60 minutes.\n\n### `track.scrobble`\n\nScrobble up to 50 tracks.\n\n*Requires:* signed, session key.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `artist[i]` | yes | Artist name |\n| `track[i]` | yes | Track title |\n| `timestamp[i]` | yes | Unix time the track started playing |\n| `album[i]` | no | Album title |\n| `albumArtist[i]` | no | Album artist, if different from the track artist |\n| `duration[i]` | no | Track length in seconds |\n| `trackNumber[i]` | no | Position on the album |\n| `mbid[i]` | no | MusicBrainz track id |\n\nTracks are array parameters indexed from 0 (`artist[0]`, `track[0]`, ...); a single un-indexed track is also accepted. Tracks are ignored (not an error) when the artist or track is empty (codes 1/2), the timestamp is over 14 days old (3) or more than 5 minutes in the future (4). Re-sending an already stored scrobble is accepted, so retries are safe.\n\n### `track.updateNowPlaying`\n\nSet the track the user is listening to now.\n\n*Requires:* signed, session key.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `artist` | yes | Artist name |\n| `track` | yes | Track title |\n| `album` | no | Album title |\n| `albumArtist` | no | Album artist |\n| `duration` | no | Track length in seconds; now-playing expires after it |\n| `trackNumber` | no | Position on the album |\n| `mbid` | no | MusicBrainz track id |\n\nNow playing expires after the track's duration (10 minutes if not given).\n\n### `user.getInfo`\n\nA user's profile and play count.\n\n*Requires:* api_key only.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `user` | yes | Username to fetch data for |\n\n### `user.getRecentTracks`\n\nRecently scrobbled tracks, newest first, led by the now-playing track.\n\n*Requires:* api_key only.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `user` | yes | Username to fetch data for |\n| `limit` | no | Results per page (default 50, max 200) |\n| `page` | no | Page number (default 1) |\n| `from` | no | Only scrobbles at or after this Unix time |\n| `to` | no | Only scrobbles at or before this Unix time |\n\n### `user.getTopAlbums`\n\nMost played albums over a period.\n\n*Requires:* api_key only.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `user` | yes | Username to fetch data for |\n| `period` | no | overall | 7day | 1month | 3month | 6month | 12month (default overall) |\n| `limit` | no | Results per page (default 50, max 1000) |\n| `page` | no | Page number (default 1) |\n\n### `user.getTopArtists`\n\nMost played artists over a period.\n\n*Requires:* api_key only.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `user` | yes | Username to fetch data for |\n| `period` | no | overall | 7day | 1month | 3month | 6month | 12month (default overall) |\n| `limit` | no | Results per page (default 50, max 1000) |\n| `page` | no | Page number (default 1) |\n\n### `user.getTopTracks`\n\nMost played tracks over a period.\n\n*Requires:* api_key only.\n\n| Parameter | Required | Description |\n|---|---|---|\n| `user` | yes | Username to fetch data for |\n| `period` | no | overall | 7day | 1month | 3month | 6month | 12month (default overall) |\n| `limit` | no | Results per page (default 50, max 1000) |\n| `page` | no | Page number (default 1) |", "operationId": "lastfmGet", "parameters": [ { "name": "method", "in": "query", "required": true, "description": "The API method to call, e.g. `track.scrobble`", "schema": { "type": "string", "enum": [ "auth.getMobileSession", "auth.getSession", "auth.getToken", "track.scrobble", "track.updateNowPlaying", "user.getInfo", "user.getRecentTracks", "user.getTopAlbums", "user.getTopArtists", "user.getTopTracks" ] } }, { "name": "api_key", "in": "query", "required": true, "description": "API key of one of your applications", "schema": { "type": "string" } }, { "name": "api_sig", "in": "query", "required": false, "description": "Request signature; required by signed methods (see below)", "schema": { "type": "string" } }, { "name": "sk", "in": "query", "required": false, "description": "Session key; required by methods that act as a user", "schema": { "type": "string" } }, { "name": "format", "in": "query", "required": false, "description": "`xml` (default) or `json`", "schema": { "type": "string", "enum": [ "xml", "json" ] } }, { "name": "username", "in": "query", "required": false, "description": "Username (only for methods that take it)", "schema": { "type": "string" } }, { "name": "password", "in": "query", "required": false, "description": "Password (send over HTTPS, as a POST body) (only for methods that take it)", "schema": { "type": "string" } }, { "name": "token", "in": "query", "required": false, "description": "Token from auth.getToken, approved by the user (only for methods that take it)", "schema": { "type": "string" } }, { "name": "artist", "in": "query", "required": false, "description": "Artist name (only for methods that take it)", "schema": { "type": "string" } }, { "name": "track", "in": "query", "required": false, "description": "Track title (only for methods that take it)", "schema": { "type": "string" } }, { "name": "album", "in": "query", "required": false, "description": "Album title (only for methods that take it)", "schema": { "type": "string" } }, { "name": "albumArtist", "in": "query", "required": false, "description": "Album artist (only for methods that take it)", "schema": { "type": "string" } }, { "name": "duration", "in": "query", "required": false, "description": "Track length in seconds; now-playing expires after it (only for methods that take it)", "schema": { "type": "string" } }, { "name": "trackNumber", "in": "query", "required": false, "description": "Position on the album (only for methods that take it)", "schema": { "type": "string" } }, { "name": "mbid", "in": "query", "required": false, "description": "MusicBrainz track id (only for methods that take it)", "schema": { "type": "string" } }, { "name": "user", "in": "query", "required": false, "description": "Username to fetch data for (only for methods that take it)", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "required": false, "description": "Results per page (default 50, max 200) (only for methods that take it)", "schema": { "type": "string" } }, { "name": "page", "in": "query", "required": false, "description": "Page number (default 1) (only for methods that take it)", "schema": { "type": "string" } }, { "name": "from", "in": "query", "required": false, "description": "Only scrobbles at or after this Unix time (only for methods that take it)", "schema": { "type": "string" } }, { "name": "to", "in": "query", "required": false, "description": "Only scrobbles at or before this Unix time (only for methods that take it)", "schema": { "type": "string" } }, { "name": "period", "in": "query", "required": false, "description": "overall | 7day | 1month | 3month | 6month | 12month (default overall) (only for methods that take it)", "schema": { "type": "string" } } ], "responses": { "200": { "description": "`` wrapping the method's result, or JSON", "content": { "application/xml": { "schema": { "type": "string" }, "examples": { "auth.getMobileSession": { "summary": "auth.getMobileSession", "value": "aliced580d57f32848f5dcf574d1ce18d78b20" }, "auth.getSession": { "summary": "auth.getSession", "value": "aliced580d57f32848f5dcf574d1ce18d78b20" }, "auth.getToken": { "summary": "auth.getToken", "value": "cf45fe5a3e3cebe168480a086d7fe481" }, "track.scrobble": { "summary": "track.scrobble", "value": "ReckonerRadioheadIn Rainbows1700000000" }, "track.updateNowPlaying": { "summary": "track.updateNowPlaying", "value": "ReckonerRadiohead" }, "user.getInfo": { "summary": "user.getInfo", "value": "alice123421080001700000000" }, "user.getRecentTracks": { "summary": "user.getRecentTracks", "value": "RadioheadNudeIn RainbowsRadioheadReckonerIn Rainbows14 Nov 2023, 22:13" }, "user.getTopAlbums": { "summary": "user.getTopAlbums", "value": "In Rainbows20Radiohead" }, "user.getTopArtists": { "summary": "user.getTopArtists", "value": "Radiohead42" }, "user.getTopTracks": { "summary": "user.getTopTracks", "value": "Reckoner29012Radiohead" } } }, "application/json": { "schema": { "type": "object" } } } }, "400": { "description": "Unknown method or invalid parameters (codes 3, 6)", "content": { "application/xml": { "schema": { "type": "string" }, "example": "Invalid parameters" }, "application/json": { "schema": { "$ref": "#/components/schemas/LastfmError" } } } }, "403": { "description": "Authentication failed (codes 4, 9, 10, 13, 14, 15)", "content": { "application/xml": { "schema": { "type": "string" }, "example": "Invalid parameters" }, "application/json": { "schema": { "$ref": "#/components/schemas/LastfmError" } } } } } }, "post": { "tags": [ "Last.fm" ], "summary": "Call a Last.fm API method (form body)", "description": "Same as GET, with parameters in an `application/x-www-form-urlencoded` body. Write methods (`track.*`, `auth.getMobileSession`) should use POST.", "operationId": "lastfmPost", "requestBody": { "required": true, "content": { "application/x-www-form-urlencoded": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/LastfmAuthGetMobileSessionRequest" }, { "$ref": "#/components/schemas/LastfmAuthGetSessionRequest" }, { "$ref": "#/components/schemas/LastfmAuthGetTokenRequest" }, { "$ref": "#/components/schemas/LastfmTrackScrobbleRequest" }, { "$ref": "#/components/schemas/LastfmTrackUpdateNowPlayingRequest" }, { "$ref": "#/components/schemas/LastfmUserGetInfoRequest" }, { "$ref": "#/components/schemas/LastfmUserGetRecentTracksRequest" }, { "$ref": "#/components/schemas/LastfmUserGetTopAlbumsRequest" }, { "$ref": "#/components/schemas/LastfmUserGetTopArtistsRequest" }, { "$ref": "#/components/schemas/LastfmUserGetTopTracksRequest" } ] } } } }, "responses": { "200": { "description": "`` wrapping the method's result, or JSON", "content": { "application/xml": { "schema": { "type": "string" }, "examples": { "auth.getMobileSession": { "summary": "auth.getMobileSession", "value": "aliced580d57f32848f5dcf574d1ce18d78b20" }, "auth.getSession": { "summary": "auth.getSession", "value": "aliced580d57f32848f5dcf574d1ce18d78b20" }, "auth.getToken": { "summary": "auth.getToken", "value": "cf45fe5a3e3cebe168480a086d7fe481" }, "track.scrobble": { "summary": "track.scrobble", "value": "ReckonerRadioheadIn Rainbows1700000000" }, "track.updateNowPlaying": { "summary": "track.updateNowPlaying", "value": "ReckonerRadiohead" }, "user.getInfo": { "summary": "user.getInfo", "value": "alice123421080001700000000" }, "user.getRecentTracks": { "summary": "user.getRecentTracks", "value": "RadioheadNudeIn RainbowsRadioheadReckonerIn Rainbows14 Nov 2023, 22:13" }, "user.getTopAlbums": { "summary": "user.getTopAlbums", "value": "In Rainbows20Radiohead" }, "user.getTopArtists": { "summary": "user.getTopArtists", "value": "Radiohead42" }, "user.getTopTracks": { "summary": "user.getTopTracks", "value": "Reckoner29012Radiohead" } } }, "application/json": { "schema": { "type": "object" } } } }, "400": { "description": "Unknown method or invalid parameters (codes 3, 6)", "content": { "application/xml": { "schema": { "type": "string" }, "example": "Invalid parameters" }, "application/json": { "schema": { "$ref": "#/components/schemas/LastfmError" } } } }, "403": { "description": "Authentication failed (codes 4, 9, 10, 13, 14, 15)", "content": { "application/xml": { "schema": { "type": "string" }, "example": "Invalid parameters" }, "application/json": { "schema": { "$ref": "#/components/schemas/LastfmError" } } } } } } }, "/api/auth/": { "get": { "tags": [ "Last.fm" ], "summary": "Approve a desktop-auth token", "description": "Where Last.fm clients send the user after `auth.getToken`. Redirects to the web UI's approve page, which asks the user to allow access.", "operationId": "lastfmApproveRedirect", "parameters": [ { "name": "api_key", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "token", "in": "query", "required": true, "schema": { "type": "string" } } ], "responses": { "302": { "description": "Redirect to the web UI's approve page" } } } }, "/api/v1/federation/settings": { "get": { "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SharingSettings" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "Your sharing settings", "description": "Sharing is off and posts are followers-only until you change them.", "tags": [ "Federation" ], "security": [ { "bearerAuth": [] } ] }, "patch": { "responses": { "422": { "description": "Invalid settings", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SharingSettings" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SharingSettingsUpdate" } } } }, "summary": "Change your sharing settings", "description": "Turning sharing on makes you findable as your handle. Your handle can't change once\npeople follow you. Visibility changes apply to new posts only.", "tags": [ "Federation" ], "security": [ { "bearerAuth": [] } ] } }, "/api/v1/federation/profiles/{username}": { "get": { "responses": { "404": { "description": "No one sharing with that name", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicProfile" } } } }, "default": { "$ref": "#/components/responses/DEFAULT_ERROR" } }, "summary": "A public fediverse profile", "description": "For the web UI's profile page. Only users who share are visible.", "tags": [ "Federation" ] }, "parameters": [ { "in": "path", "name": "username", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/.well-known/webfinger": { "get": { "tags": [ "ActivityPub" ], "summary": "WebFinger", "description": "Resolves `acct:user@domain` (or an actor URL) to the user's actor. Only users sharing their listening can be found.", "operationId": "federation_webfinger_lookup", "responses": { "200": { "description": "JRD", "content": { "application/jrd+json": { "schema": { "type": "object" } } } }, "400": { "description": "Not a resource on this server" }, "404": { "description": "Unknown, or not sharing (the two are indistinguishable)" } }, "parameters": [ { "name": "resource", "in": "query", "required": true, "schema": { "type": "string" }, "example": "acct:alice@scrobble.example" } ] } }, "/.well-known/host-meta": { "get": { "tags": [ "ActivityPub" ], "summary": "host-meta", "description": "XRD pointing at WebFinger (RFC 6415).", "operationId": "federation_host_meta", "responses": { "200": { "description": "XRD", "content": { "application/xrd+xml": { "schema": { "type": "string" } } } } } } }, "/.well-known/nodeinfo": { "get": { "tags": [ "ActivityPub" ], "summary": "NodeInfo discovery", "description": "Links to the NodeInfo 2.1 document.", "operationId": "federation_nodeinfo_discovery", "responses": { "200": { "description": "Links", "content": { "application/json": { "schema": { "type": "object" } } } } } } }, "/nodeinfo/2.1": { "get": { "tags": [ "ActivityPub" ], "summary": "NodeInfo 2.1", "description": "Software name and version, protocols, and users sharing.", "operationId": "federation_nodeinfo_document", "responses": { "200": { "description": "NodeInfo", "content": { "application/json": { "schema": { "type": "object" } } } } } } }, "/users/{username}": { "get": { "tags": [ "ActivityPub" ], "summary": "Actor", "description": "A user's `Person` actor when asked for ActivityPub JSON; browsers are redirected to the web UI's profile page.", "operationId": "federation_actor", "responses": { "200": { "description": "Person", "content": { "application/activity+json": { "schema": { "type": "object" } } } }, "302": { "description": "Redirect to the profile page (non-ActivityPub Accept)" }, "404": { "description": "Unknown, or not sharing (the two are indistinguishable)" } }, "parameters": [ { "name": "username", "in": "path", "required": true, "schema": { "type": "string" } } ] }, "parameters": [ { "in": "path", "name": "username", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/users/{username}/outbox": { "get": { "tags": [ "ActivityPub" ], "summary": "Outbox", "description": "The user's published activities.", "operationId": "federation_outbox", "responses": { "200": { "description": "OrderedCollection", "content": { "application/activity+json": { "schema": { "type": "object" } } } }, "404": { "description": "Unknown, or not sharing (the two are indistinguishable)" } }, "parameters": [ { "name": "username", "in": "path", "required": true, "schema": { "type": "string" } } ] }, "parameters": [ { "in": "path", "name": "username", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/users/{username}/followers": { "get": { "tags": [ "ActivityPub" ], "summary": "Followers", "description": "Follower count (members aren't listed).", "operationId": "federation_followers", "responses": { "200": { "description": "OrderedCollection", "content": { "application/activity+json": { "schema": { "type": "object" } } } }, "404": { "description": "Unknown, or not sharing (the two are indistinguishable)" } }, "parameters": [ { "name": "username", "in": "path", "required": true, "schema": { "type": "string" } } ] }, "parameters": [ { "in": "path", "name": "username", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/users/{username}/following": { "get": { "tags": [ "ActivityPub" ], "summary": "Following", "description": "Accounts the user follows.", "operationId": "federation_following", "responses": { "200": { "description": "OrderedCollection", "content": { "application/activity+json": { "schema": { "type": "object" } } } }, "404": { "description": "Unknown, or not sharing (the two are indistinguishable)" } }, "parameters": [ { "name": "username", "in": "path", "required": true, "schema": { "type": "string" } } ] }, "parameters": [ { "in": "path", "name": "username", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/actor": { "get": { "tags": [ "ActivityPub" ], "summary": "Instance actor", "description": "The server's `Application` actor.", "operationId": "federation_instance_actor", "responses": { "200": { "description": "Application", "content": { "application/activity+json": { "schema": { "type": "object" } } } } } } }, "/actor/outbox": { "get": { "tags": [ "ActivityPub" ], "summary": "Instance outbox", "description": "Always empty.", "operationId": "federation_instance_outbox", "responses": { "200": { "description": "OrderedCollection", "content": { "application/activity+json": { "schema": { "type": "object" } } } } } } }, "/users/{username}/inbox": { "post": { "tags": [ "ActivityPub" ], "summary": "User inbox", "description": "Receives signed activities for one user. They're stored and answered with 202, then verified and processed in the background.", "operationId": "federation_user_inbox", "responses": { "202": { "description": "Accepted for processing (also for a repeated activity)" }, "400": { "description": "Not an activity with an id, type and actor" }, "403": { "description": "The sender's domain is blocked" }, "404": { "description": "No such user sharing (user inbox)" }, "413": { "description": "Larger than 256 KB" }, "415": { "description": "Not ActivityPub JSON" } }, "parameters": [ { "name": "username", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/activity+json": { "schema": { "type": "object" } } } } }, "parameters": [ { "in": "path", "name": "username", "required": true, "schema": { "type": "string", "minLength": 1 } } ] }, "/inbox": { "post": { "tags": [ "ActivityPub" ], "summary": "Shared inbox", "description": "Receives signed activities for any user on this server (as for the user inbox).", "operationId": "federation_shared_inbox", "responses": { "202": { "description": "Accepted for processing (also for a repeated activity)" }, "400": { "description": "Not an activity with an id, type and actor" }, "403": { "description": "The sender's domain is blocked" }, "404": { "description": "No such user sharing (user inbox)" }, "413": { "description": "Larger than 256 KB" }, "415": { "description": "Not ActivityPub JSON" } }, "requestBody": { "content": { "application/activity+json": { "schema": { "type": "object" } } } } } }, "/activities/{activity_uuid}": { "get": { "tags": [ "ActivityPub" ], "summary": "Activity", "description": "One of our activities, when public. Replies to follows aren't public.", "operationId": "federation_activity", "responses": { "200": { "description": "Activity", "content": { "application/activity+json": { "schema": { "type": "object" } } } }, "404": { "description": "Not found or not public" } }, "parameters": [ { "name": "activity_uuid", "in": "path", "required": true, "schema": { "type": "string" } } ] }, "parameters": [ { "in": "path", "name": "activity_uuid", "required": true, "schema": { "type": "string", "minLength": 1 } } ] } }, "tags": [ { "name": "Auth", "description": "Web UI accounts and login" }, { "name": "Apps", "description": "API applications. Each has an API key and shared secret that a scrobbling client uses against the Last.fm-compatible `/2.0/` endpoint." }, { "name": "Sessions", "description": "Last.fm session keys issued to scrobbling clients on your behalf." }, { "name": "Tokens", "description": "Approve Last.fm desktop-auth tokens. Clients send the user to `/api/auth/`, which redirects to the UI's approve page, which calls these endpoints." }, { "name": "Stats", "description": "Your listening history and statistics" }, { "name": "Imports", "description": "Import listening history from a Last.fm export file, or straight from Last.fm. Imports run in the background; poll a job to follow its progress." }, { "name": "Health", "description": "Liveness for load balancers and containers" }, { "name": "Last.fm", "description": "Last.fm-compatible API for players and scrobblers" }, { "name": "Federation", "description": "Sharing listening on the fediverse (ActivityPub). These endpoints only exist when the server has federation enabled; a 404 means it doesn't." }, { "name": "ActivityPub", "description": "Fediverse endpoints, served on the web UI's domain" } ], "openapi": "3.1.0", "components": { "schemas": { "ErrorDetail": { "type": "object", "properties": { "code": { "type": "string", "example": "invalid_credentials" }, "message": { "type": "string", "example": "Wrong username or password" }, "details": { "type": "object", "description": "Per-field validation errors, if any", "additionalProperties": {} } }, "required": [ "code", "message" ], "additionalProperties": false }, "Error": { "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDetail" } }, "required": [ "error" ], "additionalProperties": false }, "PaginationMetadata": { "type": "object", "properties": { "total": { "type": "integer", "description": "Total number of items." }, "total_pages": { "type": "integer", "description": "Total number of pages." }, "first_page": { "type": "integer", "description": "First available page number." }, "last_page": { "type": "integer", "description": "Last available page number." }, "page": { "type": "integer", "description": "Current page number." }, "previous_page": { "type": "integer", "description": "Previous page number." }, "next_page": { "type": "integer", "description": "Next page number." } }, "additionalProperties": false }, "Register": { "type": "object", "properties": { "username": { "type": "string", "minLength": 2, "maxLength": 32 }, "email": { "type": "string", "format": "email" }, "password": { "type": "string", "writeOnly": true, "minLength": 8 } }, "required": [ "email", "password", "username" ], "additionalProperties": false }, "User": { "type": "object", "properties": { "id": { "type": "integer", "readOnly": true }, "username": { "type": "string", "readOnly": true, "example": "alice" }, "email": { "type": "string", "readOnly": true, "example": "alice@example.com" }, "created_at": { "type": "string", "format": "date-time", "readOnly": true } }, "additionalProperties": false }, "Token": { "type": "object", "properties": { "token": { "type": "string", "description": "Bearer token for the Authorization header" }, "user": { "$ref": "#/components/schemas/User" } }, "required": [ "token", "user" ], "additionalProperties": false }, "Login": { "type": "object", "properties": { "username": { "type": "string" }, "password": { "type": "string", "writeOnly": true } }, "required": [ "password", "username" ], "additionalProperties": false }, "ApiApp": { "type": "object", "properties": { "name": { "type": "string", "readOnly": true, "example": "Living room player" }, "api_key": { "type": "string", "readOnly": true, "example": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "shared_secret": { "type": "string", "readOnly": true, "example": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" }, "created_at": { "type": "string", "format": "date-time", "readOnly": true } }, "additionalProperties": false }, "ApiAppCreate": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 } }, "required": [ "name" ], "additionalProperties": false }, "Session": { "type": "object", "properties": { "id": { "type": "integer", "readOnly": true }, "app_name": { "type": "string", "readOnly": true, "example": "Pano Scrobbler" }, "created_at": { "type": "string", "format": "date-time", "readOnly": true } }, "additionalProperties": false }, "AuthTokenInfo": { "type": "object", "properties": { "app_name": { "type": "string", "readOnly": true, "example": "Pano Scrobbler" }, "approved": { "type": "boolean", "readOnly": true } }, "additionalProperties": false }, "ApproveToken": { "type": "object", "properties": { "token": { "type": "string", "description": "Token from auth.getToken" } }, "required": [ "token" ], "additionalProperties": false }, "NowPlayingTrack": { "type": "object", "properties": { "artist": { "type": "string" }, "track": { "type": "string" }, "album": { "type": [ "string", "null" ] }, "duration": { "type": [ "integer", "null" ] }, "started_at": { "type": "string", "format": "date-time" }, "expires_at": { "type": "string", "format": "date-time" } }, "additionalProperties": false }, "NowPlaying": { "type": "object", "properties": { "now_playing": { "description": "null when idle", "anyOf": [ { "$ref": "#/components/schemas/NowPlayingTrack" }, { "type": "null" } ] } }, "additionalProperties": false }, "Scrobble": { "type": "object", "properties": { "artist": { "type": "string" }, "track": { "type": "string" }, "album": { "type": [ "string", "null" ] }, "album_artist": { "type": [ "string", "null" ] }, "duration": { "type": [ "integer", "null" ] }, "played_at": { "type": "string", "format": "date-time" } }, "additionalProperties": false }, "RecentPage": { "type": "object", "properties": { "page": { "type": "integer" }, "per_page": { "type": "integer" }, "total": { "type": "integer" }, "total_pages": { "type": "integer" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/Scrobble" } } }, "additionalProperties": false }, "TopItem": { "type": "object", "properties": { "rank": { "type": "integer" }, "name": { "type": "string" }, "artist": { "type": [ "string", "null" ], "description": "Albums and tracks only" }, "playcount": { "type": "integer" } }, "additionalProperties": false }, "TopPage": { "type": "object", "properties": { "page": { "type": "integer" }, "per_page": { "type": "integer" }, "total": { "type": "integer" }, "total_pages": { "type": "integer" }, "period": { "type": "string" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/TopItem" } } }, "additionalProperties": false }, "Count": { "type": "object", "properties": { "start": { "type": "string", "format": "date", "description": "First day of the bucket (UTC)" }, "count": { "type": "integer" } }, "additionalProperties": false }, "Summary": { "type": "object", "properties": { "scrobbles": { "type": "integer" }, "artists": { "type": "integer" }, "tracks": { "type": "integer" }, "first_scrobble_at": { "type": [ "string", "null" ], "format": "date-time" } }, "additionalProperties": false }, "ImportOptions": { "type": "object", "properties": { "sources": { "type": "array", "description": "`lastfm` is only listed when the server has a Last.fm API key", "items": { "type": "string", "enum": [ "csv", "json", "lastfm" ] } }, "max_upload_bytes": { "type": "integer" } }, "additionalProperties": false }, "ImportFile": { "type": "object", "properties": { "file": { "description": "CSV or JSON export, optionally gzipped", "type": "string", "format": "binary" } }, "required": [ "file" ], "additionalProperties": false }, "ImportJob": { "type": "object", "properties": { "id": { "type": "integer" }, "source": { "type": "string", "enum": [ "csv", "json", "lastfm" ] }, "status": { "type": "string", "enum": [ "pending", "running", "completed", "failed", "cancelled" ] }, "filename": { "type": [ "string", "null" ] }, "lastfm_username": { "type": [ "string", "null" ] }, "total": { "type": [ "integer", "null" ], "description": "Rows or tracks to process, once known" }, "processed": { "type": "integer" }, "imported": { "type": "integer", "description": "New scrobbles added" }, "duplicates": { "type": "integer", "description": "Already in your history" }, "skipped": { "type": "integer", "description": "No artist/track, bad date, or future" }, "error": { "type": [ "string", "null" ] }, "created_at": { "type": "string", "format": "date-time" }, "started_at": { "type": [ "string", "null" ], "format": "date-time" }, "finished_at": { "type": [ "string", "null" ], "format": "date-time" } }, "additionalProperties": false }, "LastfmImport": { "type": "object", "properties": { "username": { "type": "string", "minLength": 1, "maxLength": 64, "example": "rj" } }, "required": [ "username" ], "additionalProperties": false }, "Health": { "type": "object", "properties": { "status": { "type": "string", "example": "ok" } }, "additionalProperties": false }, "LastfmError": { "type": "object", "properties": { "error": { "type": "integer", "examples": [ 6 ] }, "message": { "type": "string" } }, "required": [ "error", "message" ] }, "LastfmAuthGetMobileSessionRequest": { "type": "object", "title": "auth.getMobileSession", "description": "Create a session key from a username and password", "properties": { "method": { "type": "string", "const": "auth.getMobileSession" }, "api_key": { "type": "string" }, "api_sig": { "type": "string", "description": "md5 request signature" }, "username": { "type": "string", "description": "Username", "examples": [ "alice" ] }, "password": { "type": "string", "description": "Password (send over HTTPS, as a POST body)" }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "api_sig", "username", "password" ] }, "LastfmAuthGetSessionRequest": { "type": "object", "title": "auth.getSession", "description": "Exchange an approved token for a session key (desktop auth flow, step 3)", "properties": { "method": { "type": "string", "const": "auth.getSession" }, "api_key": { "type": "string" }, "api_sig": { "type": "string", "description": "md5 request signature" }, "token": { "type": "string", "description": "Token from auth.getToken, approved by the user" }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "api_sig", "token" ] }, "LastfmAuthGetTokenRequest": { "type": "object", "title": "auth.getToken", "description": "Fetch an unapproved request token (desktop auth flow, step 1)", "properties": { "method": { "type": "string", "const": "auth.getToken" }, "api_key": { "type": "string" }, "api_sig": { "type": "string", "description": "md5 request signature" }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "api_sig" ] }, "LastfmTrackScrobbleRequest": { "type": "object", "title": "track.scrobble", "description": "Scrobble up to 50 tracks", "properties": { "method": { "type": "string", "const": "track.scrobble" }, "api_key": { "type": "string" }, "api_sig": { "type": "string", "description": "md5 request signature" }, "sk": { "type": "string", "description": "Session key" }, "artist[i]": { "type": "string", "description": "Artist name", "examples": [ "Radiohead" ] }, "track[i]": { "type": "string", "description": "Track title", "examples": [ "Reckoner" ] }, "timestamp[i]": { "type": "string", "description": "Unix time the track started playing" }, "album[i]": { "type": "string", "description": "Album title" }, "albumArtist[i]": { "type": "string", "description": "Album artist, if different from the track artist" }, "duration[i]": { "type": "string", "description": "Track length in seconds" }, "trackNumber[i]": { "type": "string", "description": "Position on the album" }, "mbid[i]": { "type": "string", "description": "MusicBrainz track id" }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "api_sig", "sk", "artist[i]", "track[i]", "timestamp[i]" ] }, "LastfmTrackUpdateNowPlayingRequest": { "type": "object", "title": "track.updateNowPlaying", "description": "Set the track the user is listening to now", "properties": { "method": { "type": "string", "const": "track.updateNowPlaying" }, "api_key": { "type": "string" }, "api_sig": { "type": "string", "description": "md5 request signature" }, "sk": { "type": "string", "description": "Session key" }, "artist": { "type": "string", "description": "Artist name", "examples": [ "Radiohead" ] }, "track": { "type": "string", "description": "Track title", "examples": [ "Reckoner" ] }, "album": { "type": "string", "description": "Album title" }, "albumArtist": { "type": "string", "description": "Album artist" }, "duration": { "type": "string", "description": "Track length in seconds; now-playing expires after it" }, "trackNumber": { "type": "string", "description": "Position on the album" }, "mbid": { "type": "string", "description": "MusicBrainz track id" }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "api_sig", "sk", "artist", "track" ] }, "LastfmUserGetInfoRequest": { "type": "object", "title": "user.getInfo", "description": "A user's profile and play count", "properties": { "method": { "type": "string", "const": "user.getInfo" }, "api_key": { "type": "string" }, "user": { "type": "string", "description": "Username to fetch data for", "examples": [ "alice" ] }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "user" ] }, "LastfmUserGetRecentTracksRequest": { "type": "object", "title": "user.getRecentTracks", "description": "Recently scrobbled tracks, newest first, led by the now-playing track", "properties": { "method": { "type": "string", "const": "user.getRecentTracks" }, "api_key": { "type": "string" }, "user": { "type": "string", "description": "Username to fetch data for", "examples": [ "alice" ] }, "limit": { "type": "string", "description": "Results per page (default 50, max 200)", "examples": [ "50" ] }, "page": { "type": "string", "description": "Page number (default 1)", "examples": [ "1" ] }, "from": { "type": "string", "description": "Only scrobbles at or after this Unix time" }, "to": { "type": "string", "description": "Only scrobbles at or before this Unix time" }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "user" ] }, "LastfmUserGetTopAlbumsRequest": { "type": "object", "title": "user.getTopAlbums", "description": "Most played albums over a period", "properties": { "method": { "type": "string", "const": "user.getTopAlbums" }, "api_key": { "type": "string" }, "user": { "type": "string", "description": "Username to fetch data for", "examples": [ "alice" ] }, "period": { "type": "string", "description": "overall | 7day | 1month | 3month | 6month | 12month (default overall)", "examples": [ "7day" ] }, "limit": { "type": "string", "description": "Results per page (default 50, max 1000)", "examples": [ "50" ] }, "page": { "type": "string", "description": "Page number (default 1)", "examples": [ "1" ] }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "user" ] }, "LastfmUserGetTopArtistsRequest": { "type": "object", "title": "user.getTopArtists", "description": "Most played artists over a period", "properties": { "method": { "type": "string", "const": "user.getTopArtists" }, "api_key": { "type": "string" }, "user": { "type": "string", "description": "Username to fetch data for", "examples": [ "alice" ] }, "period": { "type": "string", "description": "overall | 7day | 1month | 3month | 6month | 12month (default overall)", "examples": [ "7day" ] }, "limit": { "type": "string", "description": "Results per page (default 50, max 1000)", "examples": [ "50" ] }, "page": { "type": "string", "description": "Page number (default 1)", "examples": [ "1" ] }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "user" ] }, "LastfmUserGetTopTracksRequest": { "type": "object", "title": "user.getTopTracks", "description": "Most played tracks over a period", "properties": { "method": { "type": "string", "const": "user.getTopTracks" }, "api_key": { "type": "string" }, "user": { "type": "string", "description": "Username to fetch data for", "examples": [ "alice" ] }, "period": { "type": "string", "description": "overall | 7day | 1month | 3month | 6month | 12month (default overall)", "examples": [ "7day" ] }, "limit": { "type": "string", "description": "Results per page (default 50, max 1000)", "examples": [ "50" ] }, "page": { "type": "string", "description": "Page number (default 1)", "examples": [ "1" ] }, "format": { "type": "string", "enum": [ "xml", "json" ], "default": "xml" } }, "required": [ "method", "api_key", "user" ] }, "SharingSettings": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Share listening on the fediverse" }, "visibility": { "type": "string", "enum": [ "followers", "unlisted", "public" ], "description": "Who sees posts: `followers` (default), `unlisted` (anyone visiting the profile, not public timelines) or `public`. Followers-only is only as private as who may follow: see `manually_approves_followers`." }, "manually_approves_followers": { "type": "boolean" }, "discoverable": { "type": "boolean", "description": "May appear in profile directories" }, "indexable": { "type": "boolean", "description": "Posts may be indexed for search" }, "display_name": { "type": [ "string", "null" ], "maxLength": 100 }, "bio": { "type": [ "string", "null" ], "maxLength": 500 }, "handle": { "type": "string", "readOnly": true, "example": "@alice@scrobble.example" }, "actor_url": { "type": "string", "readOnly": true }, "profile_url": { "type": "string", "readOnly": true }, "followers": { "type": "integer", "readOnly": true, "description": "0 until following arrives" } }, "additionalProperties": false }, "SharingSettingsUpdate": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Share listening on the fediverse" }, "visibility": { "type": "string", "enum": [ "followers", "unlisted", "public" ], "description": "Who sees posts: `followers` (default), `unlisted` (anyone visiting the profile, not public timelines) or `public`. Followers-only is only as private as who may follow: see `manually_approves_followers`." }, "manually_approves_followers": { "type": "boolean" }, "discoverable": { "type": "boolean", "description": "May appear in profile directories" }, "indexable": { "type": "boolean", "description": "Posts may be indexed for search" }, "display_name": { "type": [ "string", "null" ], "maxLength": 100 }, "bio": { "type": [ "string", "null" ], "maxLength": 500 }, "handle": { "type": "string", "readOnly": true, "example": "@alice@scrobble.example" }, "actor_url": { "type": "string", "readOnly": true }, "profile_url": { "type": "string", "readOnly": true }, "followers": { "type": "integer", "readOnly": true, "description": "0 until following arrives" } }, "additionalProperties": false }, "PublicProfile": { "type": "object", "properties": { "username": { "type": "string" }, "display_name": { "type": "string" }, "bio": { "type": [ "string", "null" ] }, "handle": { "type": "string", "example": "@alice@scrobble.example" }, "actor_url": { "type": "string" } }, "additionalProperties": false } }, "responses": { "UNPROCESSABLE_CONTENT": { "description": "Unprocessable Content", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "DEFAULT_ERROR": { "description": "Default error response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "description": "Token from POST /api/v1/auth/login" } } } }