Lemmy hub

Lemmy Search API

Four result lists in one answer: posts, comments, communities and users, filtered the way the instance filters them.

GET /v1/lemmy/search

1 credit Failed requests are free

About this endpoint

GET /v1/lemmy/search?instance=lemmy.world&query=linux&type=Posts returns data.posts, data.comments, data.communities and data.users. Each post and comment row carries its community, author and counts; a user hit carries the full profile, including avatar, bio, join date, post and comment counts and the admin flag.

type is All, Comments, Posts, Communities, Users or Url; Url finds posts linking to an exact URL. All and Comments can take much longer than the other kinds on a large instance. Narrow with community, author or scope, and order with the instance's sorts. Search returns no total, and an empty result is a found answer with empty lists, not not_found.

Lemmy Search API FAQ

How do I search for a link?

Set type=Url and query to the exact URL. The instance returns posts that link to it.

Why are there two empty lists?

The answer always has all four lists. A type filter fills the matching one and leaves the others empty; that is still a found answer.

Can I search within a community or by author?

Yes. Pass community, author, or both.

Why are All and Comments slow?

They cover every kind or every comment's text, which takes longer on a large instance. Posts, Communities and Users are quicker.

How many credits does a search 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. Each paginated page is a separate billed request.