> **For coding agents and LLMs:** This is one Social Fetch marketing page (markdown export). For API orientation start with [`/llms.txt`](https://www.socialfetch.dev/llms.txt); for auth and crawl rules use [`/agents.txt`](https://www.socialfetch.dev/agents.txt); for every operation use [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt).

## This page

- **On-site (HTML):** <https://www.socialfetch.dev/platforms/lemmy>
- **Markdown (.mdx) URL:** <https://www.socialfetch.dev/platforms/lemmy.mdx>

---

# Lemmy API. Any instance, one JSON shape.

Communities, posts, comments, users, search and moderation logs from any Lemmy instance you name. Point at a host, get typed JSON back.

- Any Lemmy instance
- Communities + posts
- From 1 credit per request

Lemmy is federated: thousands of independent instances run the same software, and each one holds its own copy of communities, posts and users. Every Social Fetch call names the instance with `instance=lemmy.world` or `instance=lemmy.ml`. Ids, counts and sorts belong to that instance, and a community or user on another instance can be resolved with `name@host` or `user@host`.

The routes under `/v1/lemmy` cover an instance and its NodeInfo, its federated-instance table, community lists and one community, post lists and one post, a post's comments and the latest comments, one comment, a user profile and that user's posts or comments, search, and the public moderation log. Lookups return `site`, `community`, `post`, `comment` or `user`; lists return `communities`, `posts`, `comments`, `instances` or top-level `entries`.

Every response uses the `{ data, meta }` envelope with `data.lookupStatus`, so a missing post, a private instance, a host that is not Lemmy and a host name that does not resolve come back as typed states rather than errors. Lists carry `page.page`, `page.hasMore`, `page.nextPage`, `page.nextCursor` and `page.limitReached`; on 0.19 and later the posts response also carries the instance's own continuation cursor, which can walk past the numbered page ceiling.

A private instance returns `lookupStatus: private` and is charged like any other answer; an instance that cannot be reached returns 503 and is not charged.

## What you can get

- An instance's site object and NodeInfo: version, user and post counts, registration mode, federation settings, admins and languages.
- The domains an instance federates with, or its block list, with software, version and delivery state.
- Community lists by sort and scope, and one community with subscriber, post, comment and active-user counts.
- Post lists for an instance or a community, by any sort the version supports, with NSFW included on request.
- One post with its cross-posts and the community's moderators, or one post found from a comment id.
- A post's comments, the latest comments on an instance, and one comment including removed and deleted rows.
- A user profile with counts and moderated communities, plus their posts or comments by time or a time-window top.
- Search for posts, comments, communities, users or an exact URL, and the public moderation log by kind or community.

## Lemmy endpoints

| Endpoint | Request | Credits | Docs |
| --- | --- | --- | --- |
| Instance | GET /v1/lemmy/instance | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/instance/get) |
| Federated instances | GET /v1/lemmy/instances | 2 credits Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/instances/get) |
| Communities | GET /v1/lemmy/communities | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/communities/get) |
| Community | GET /v1/lemmy/community | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/community/get) |
| Posts | GET /v1/lemmy/posts | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/posts/get) |
| Post | GET /v1/lemmy/post | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/post/get) |
| Post comments | GET /v1/lemmy/post/comments | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/post/comments/get) |
| Latest comments | GET /v1/lemmy/comments | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/comments/get) |
| Comment | GET /v1/lemmy/comment | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/comment/get) |
| User | GET /v1/lemmy/user | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/user/get) |
| User posts | GET /v1/lemmy/user/posts | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/user/posts/get) |
| User comments | GET /v1/lemmy/user/comments | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/user/comments/get) |
| Search | GET /v1/lemmy/search | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/search/get) |
| Moderation log | GET /v1/lemmy/modlog | 1 credit Failed requests are free | [docs](https://www.socialfetch.dev/docs/api/v1/lemmy/modlog/get) |

## How to start

1. **Create an API key.** Sign up at Social Fetch and copy a key (`sfk_...`). New accounts get 100 free credits, enough to try every Lemmy route on a few instances.
2. **Name the instance and route.** Use the host that holds the data, for example `GET /v1/lemmy/community?instance=lemmy.world&name=technology` or `GET /v1/lemmy/posts?instance=lemmy.ml&scope=local&sort=New`. Send `x-api-key` on every request.
3. **Branch and page.** Check `data.lookupStatus` before you store a row, follow `page.nextCursor` while `page.hasMore` is true, and bill from `meta.creditsCharged`.

## Pricing

Each Lemmy route charges a flat credit amount per completed request, shown on every endpoint page. Each page of a list is its own request. Credits never expire on pay-as-you-go packs, and `meta.creditsCharged` on every response is the billing source of truth.

## Compared with the official API

Every Lemmy instance runs its own version: 0.18 has no instance `next_page` cursor, no `Scaled` sort and no `visibility` field, while 0.19 adds them. Counts and ids are local to the instance you name. Social Fetch keeps one response shape across both versions, turns a missing entity, a private instance, a host that is not Lemmy and a host name that does not resolve into typed `lookupStatus` values, and meters every page the same way. An instance that requires a login is reported as such.

## FAQ

### Is there a Lemmy API for communities, posts and comments?

Yes. Social Fetch has fourteen Lemmy routes under /v1/lemmy: instance, federated instances, community lists, one community, post lists, one post, post comments, latest comments, one comment, a user, that user's posts and comments, search, and the public moderation log. Authenticate with your Social Fetch API key in x-api-key.

### Which instance should I name?

Name the instance that holds the data you want. Counts for a community are most accurate on its home instance, and a post's comments are complete on the instance that hosts its community. You can ask another instance for a remote community with name@host or a remote user with user@host.

### Do ids and counts mean the same thing on every instance?

No. A post, comment, community and user id belongs to the instance you named, and counts can differ between a community's home instance and a copy elsewhere. Keep the instance alongside every id you store.

### How does paging work?

Every list returns page.page, page.hasMore, page.nextPage, page.nextCursor and page.limitReached. Follow page.nextCursor with the same filters while page.hasMore is true. A cursor only works with the filters it was issued for. On posts, the instance's own cursor can walk past the numbered 100-page ceiling; page.limitReached tells you when a numbered list stopped at that ceiling with rows possibly left. Lemmy pages by number over a live order, so new or re-ranked items can shift a row onto the next page. Remove repeats by `id`.

### Can I get a whole comment tree in one call?

No. A large reply tree can be hundreds of kilobytes. The post-comments route returns a normal page and includes each comment's path, depth and parentId; walk a branch by passing parentId.

### Why is a post or comment missing but still in the moderation log?

A removed or deleted post reads as lookupStatus: not_found from the post route, which is also what a never-existing id returns. A removed comment still comes back as found with removed or deleted set and content empty; a deleted user asked by username comes back as not_found with reason.code: deleted, while an id lookup returns reason: null because Lemmy gives the same result for an id that never existed. The moderation log keeps the action with the removed post's title, URL and body or the removed comment's content, so the modlog route is how you recover it.

### What happens with a private instance or a host that is not Lemmy?

HTTP 200 means the request finished. Lists and lookups against a private instance return lookupStatus: private with a short reason, while the instance route still returns the site object when the host has one. A host that is up but is not a Lemmy instance returns lookupStatus: not_compatible, a host name that does not resolve returns lookupStatus: not_found with reason.code: host_not_found, and a missing post, comment, community or user returns lookupStatus: not_found. Every HTTP 200 answer, including private and not_compatible, is a completed request and is charged the route credits. Data behind a login is never returned.

### Does search return a total?

No total. Search returns four lists (posts, comments, communities and users) in the instance's order. `query` is required and cannot be empty; `type` defaults to Posts. `All` and `Comments` can take much longer than the other kinds on a large instance. An empty result is lookupStatus: found with empty lists, not not_found.

### How much does the Lemmy API cost?

Every Lemmy route charges a flat amount per completed request, shown on each endpoint page, and each page of a list is billed separately. Check meta.creditsCharged on every response. New accounts start with 100 free credits.

### Can I use the Lemmy routes from agents or MCP?

Yes. Every Lemmy route is a typed MCP tool and is reachable through Ask (POST /v1/ask) in plain English. Use the typed routes for production jobs.

## Related

- [Lemmy Instance API](https://www.socialfetch.dev/platforms/lemmy/instance): An instance's site object and NodeInfo (`GET /v1/lemmy/instance`).
- [Lemmy Posts API](https://www.socialfetch.dev/platforms/lemmy/posts): Posts for an instance or a community (`GET /v1/lemmy/posts`).
- [Lemmy Comments API](https://www.socialfetch.dev/platforms/lemmy/post-comments): A post's comments or one comment's replies (`GET /v1/lemmy/post/comments`).
- [Lemmy Search API](https://www.socialfetch.dev/platforms/lemmy/search): Posts, comments, communities, users or an exact URL (`GET /v1/lemmy/search`).
- [Lemmy Moderation Log API](https://www.socialfetch.dev/platforms/lemmy/modlog): Public moderation actions by kind or community (`GET /v1/lemmy/modlog`).
- [Ask in plain English](https://www.socialfetch.dev/ask): Route a natural-language Lemmy question to the matching operation.
- [Hosted MCP](https://www.socialfetch.dev/mcp): Call Lemmy tools from Cursor or Claude with the same credit metering as REST.
