Lemmy User API
A profile with counts and moderated communities, plus the newest post and comment from the same answer.
GET /v1/lemmy/user1 credit Failed requests are free
About this endpoint
GET /v1/lemmy/user?instance=lemmy.ml&username=dessalines returns data.user with id, name, displayName, bio, avatar, banner, actorId, host, handle, publishedAt, updatedAt, banned, banExpiresAt, deleted, isBot, isLocal, matrixUserId, postCount, commentCount, postScore, commentScore, isAdmin and moderates.
The same request returns data.posts and data.comments with the newest row of each, because Lemmy returns both halves together. Use the user posts and user comments routes for a full page. Ask by username or numeric id, not both; user@host resolves an account on another instance. A deleted account asked by username returns lookupStatus: not_found with reason.code: deleted; a name that never existed returns not_found with reason: null. An id lookup cannot tell a deleted account from one that never existed, so it returns not_found with reason: null.
Lemmy User API FAQ
Why do posts and comments have only one row?
The profile request asks the instance for one item of each kind, and that is what it returns. The user posts and user comments routes page each half properly.
What does moderates contain?
The communities the user moderates, when the instance includes them. Each entry is a community reference with id, name, host and handle.
How do I resolve a user on another instance?
Use user@host, for example someone@lemmy.world. The answer is that instance's copy of the profile, so counts can lag the user's home instance.
How many credits does a user lookup cost?
Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth.