What you get#
Onekey exposes Lemmy as 20 endpoints behind one API key: 4 endpoints return one record (data is an object) and 16 endpoints return a list (data is an array). Every answer uses the same envelope (success, data, metadata, error), the cost is reported in metadata.credits_charged, and fields are mapped onto the unified schema so the code you write for Lemmy also works for the rest of the messaging & communities category.
Endpoints#
| Endpoint | What it does | Parameters | Credits | Status |
|---|---|---|---|---|
comments | Comments of a Lemmy post. | id*, instance | 5 | stable |
communities | Popular Lemmy communities on an instance. | instance | 5 | stable |
communities_new | Newest Lemmy communities (all federated). | instance | 5 | stable |
community | A Lemmy community. | name*, instance | 1 | stable |
community_moderators | Moderators of a Lemmy community. | name*, instance | 5 | stable |
frontpage | Hot posts across all Lemmy communities on an instance. | instance | 5 | stable |
local_posts | Hot posts from local communities of a Lemmy instance. | instance | 5 | stable |
post | A Lemmy post. | id*, instance | 1 | stable |
posts_hot | Hot posts of a Lemmy community. | name*, instance | 5 | stable |
posts_new | Newest posts of a Lemmy community. | name*, instance | 5 | stable |
posts_top | Top posts of a Lemmy community (past week). | name*, instance | 5 | stable |
search_comments | Search Lemmy comments. | q*, instance | 5 | stable |
search_communities | Search Lemmy communities. | q*, instance | 5 | stable |
search_posts | Search Lemmy posts. | q*, instance | 5 | stable |
search_users | Search Lemmy users. | q*, instance | 5 | stable |
site | Lemmy instance information. | instance | 1 | stable |
site_admins | Administrators of a Lemmy instance. | instance | 5 | stable |
user | A Lemmy user's profile. | name*, instance | 1 | stable |
user_comments | Comments by a Lemmy user. | name*, instance | 5 | stable |
user_posts | Posts by a Lemmy user. | name*, instance | 5 | stable |
A * marks a required parameter. Each endpoint name links to its reference page with the full parameter table, caching window and a recorded response.
Make a request#
This calls lemmy.community (1 credit, stable). Replace YOUR_API_KEY with your key; sign up, no card. 1,000 free credits cover the open-platform endpoints. Hard-to-reach platforms (X, TikTok, Instagram, Reddit, and others marked on their page) need a verified email and a purchased pack.
curl "https://api.onekey.dev/v1/lemmy/community?name=technology" \
-H "x-api-key: YOUR_API_KEY"Fields you get back#
These unified fields come back from Lemmy, with the same names as on every other platform. The count is how many of its 20 mapped endpoints return the field; a field the source lacks is null, never missing. 6 platform-specific fields (ext.<name>) come on top, documented on each endpoint page.
| Field | Type | Endpoints |
|---|---|---|
content.text | string | 18 |
engagement.comments | integer | 18 |
content.createdAt | ISO 8601 date | 17 |
content.title | string | 16 |
author.avatarUrl | URL | 15 |
author.displayName | string | 15 |
author.id | string | 15 |
author.username | string | 15 |
content.id | string | 15 |
entity.name | string | 13 |
author.url | URL | 12 |
engagement.likes | integer | 11 |
content.url | URL | 8 |
media.thumbnailUrl | URL | 5 |
entity.stats.followers | integer | 4 |
entity.url | URL | 4 |
package.version | string | 1 |
The full schema is in Unified schema.
Pricing#
Lemmy calls cost 1 to 5 credits, flat per endpoint. Free when served from cache (0.2 credit for a cached response over 100 KB). Invalid, failed or not-found calls are not charged. See pricing for credit packs.