Serves the caller's own account: their user, settings, password and media
token, and which of their playlists hold a dump. What they follow, their
feed and their notifications are under /api/me too, served by
routes/follows.ts and routes/notifications.ts, and their avatar by
routes/avatars.ts.
GET /api/me— signed in. Answers the caller's own user.PATCH /api/me— signed in. Changes the caller's description and email, and answers their user. The email of an account from another instance is that instance's: 400. A username changes only byuser:manage, throughPATCH /api/users/:key/username.GET /api/me/media-token— signed in. Answers a media token, for a session that predates them.GET /api/me/settings— signed in. Answers the caller's settings.PATCH /api/me/settings— signed in. Changes some of the caller's settings, and answers them all.PUT /api/me/password— signed in, with the current password. Sets a new one, ending every other session, and answers fresh tokens. 400 for an account from another instance, which has no password here.GET /api/me/playlists?contains=:dumpId— signed in. Answers each of the caller's playlists and whether it holds the dump.GET /api/me/grants— signed in. Answers the other instances the caller let their account sign in to.DELETE /api/me/grants/:host— signed in. Withdraws that grant, which ends the caller's sessions there.
A change to the caller's email or password is told to those instances
(notifyClients).
v
default: Router
Mounted by api/main.ts behind the error, Open Graph and CORS middleware.
An APIException thrown by a handler becomes the JSON error response there.
Usage
import * as mod from "api/routes/me.ts";