Docs
View as Markdown

lemmy.comments

stable Advanced

Comments of a Lemmy post.

GET /v1/lemmy/comments

What you get#

A list of Lemmy results in Onekey's unified shape, in data (an array). An empty array is a normal, successful answer and is charged like any other; a source that reports "nothing found" as an error returns a free 404 not_found instead.

What it costs#

  • Advanced · 5 credits for a fresh fetch, charged only when it succeeds.
  • Free when served from cache (0.2 credit for a cached response over 100 KB).
  • Free if the request is invalid (never charged) or the source fails or reports not found (refunded).

Parameters#

NameTypeRequiredDefaultWhat it isConstraints
instancestringno-Known Lemmy instance (allowlisted), default lemmy.worldmax 253 chars; must match [a-z0-9.-]{3,253}; trimmed, lowercased
idstringyes(required)Post id on the instancemax 12 chars; must match [0-9]{1,12}; trimmed

Request#

curl "https://api.onekey.dev/v1/lemmy/comments?id=52463999" \
  -H "x-api-key: YOUR_API_KEY"

Try it

Add your key to run this call right here. No key? Get one free. The key stays in this tab.

Recorded response#

A real Lemmy response, recorded and returned in Onekey's shape. Fields the platform does not provide are null.

json
{
  "success": true,
  "data": [
    {
      "content": {
        "id": "26056806",
        "text": "It's honestly amazing what these chips can do.\n\nUnfortunately it's stuck behind the Apple ecosystem.",
        "createdAt": "2026-09-28T13:23:20Z",
        "title": "Apple's A20 Pro shatters Geekbench 7 single-core record — 2nm chip beats desktop Intel Core i9 and AMD Ryzen 9 by up to 32%"
      },
      "ext": {
        "path": "0.26056806",
        "apUrl": "https://piefed.ca/comment/6458207"
      },
      "author": {
        "id": "15359959",
        "username": "mintiefresh",
        "displayName": "mintiefresh",
        "avatarUrl": "https://media.piefed.ca/users/oD/DX/oDDXvW3SOMJRUsh.png"
      },
      "engagement": {
        "likes": 73,
        "comments": 5
      }
    },
    {
      "content": {
        "id": "26055631",
        "text": "And yet, it can't (be made to) run a full desktop OS or play AAA games. But you can personalise the Siri voice (older phones can do the conversational stuff)... maybe edit photos faster.\n\nApple went and made a phone you could use for ten years, but next year they'll be telling you why their new phone is so much better than the last one. They don't expect you to upgrade every year, but they expect you to want to, and after a couple of generations, they want you to think that you have to.\n\nI have an iPhone 16 Pro Max (2024), and the 18 Pro/Max presentation definitely gave me a bit of phone envy. But I also have a Galaxy S10 (2019), and that does a few things better than the iPhone, even though it's 5 years difference between them. Apple's keyboard likes to hallucinate weird results (like changing out common words for names of people I don't even have in contacts) and edit after the fact. Gboard just works. When it doesn't, the mistake makes sense (if and of for example). Also, I've used the same wallpaper on both phones. It always looks better on the Samsung. Sharper colors and contrast. Hold both up and ask anyone which looks better, they're gonna point to the Samsung, even if you turn the iPhone's brightness up all the way.\n\nPhone manufacturers are desperately trying to convince you that you need the latest and greatest. You don't — unless you want to do AI stuff. And even then, they're going to charge you for it. And they're sure you'll pay, because you've already shown your",
        "createdAt": "2026-09-28T12:01:13Z",
        "title": "Apple's A20 Pro shatters Geekbench 7 single-core record — 2nm chip beats desktop Intel Core i9 and AMD Ryzen 9 by up to 32%"
      },
      "ext": {
        "path": "0.26055631",
        "apUrl": "https://lemmy.dbzer0.com/comment/28350080"
      },
      "author": {
        "id": "16867161",
        "username": "cerebralhawks",
        "displayName": "CerebralHawks",
        "avatarUrl": "https://lemmy.dbzer0.com/pictrs/image/02a1085c-4015-4b74-a968-75be35b8af90.webp"
      },
      "engagement": {
        "likes": 63,
        "comments": 30
      }
    }
  ],
  "metadata": {
    "platform": "lemmy",
    "endpoint": "comments",
    "cached": false,
    "stale": false,
    "age_s": 0,
    "fetched_at": "2026-01-01T12:00:00+00:00",
    "credits_charged": 5,
    "request_id": "7f3a9c2e5b1d4c8fa2e6d0b9c4f18e37"
  },
  "error": null
}

Field mapping#

How this endpoint's source fields become Onekey's unified schema. Fields the source lacks come back as null.

Source pathOnekey fieldTransform
comment.idcontent.idtoString
comment.contentcontent.text-
comment.publishedcontent.createdAttoIsoDate
comment.pathext.path-
comment.ap_idext.apUrlsafeUrl
creator.idauthor.idtoString
creator.nameauthor.username-
creator.display_nameauthor.displayName-
creator.avatarauthor.avatarUrlsafeUrl
post.namecontent.title-
counts.scoreengagement.likestoNumber
counts.child_countengagement.commentstoNumber

Caching and freshness#

  • Fresh for about 2 minutes. Repeat calls in that window are served from cache and are free.
  • Between 2 minutes and 15 minutes the cached copy is still served instantly and marked stale: true while Onekey refreshes it in the background.
  • If the source is down when a refresh is needed, the last copy can be served for up to 1 hour more (marked stale).
  • A "not found" is remembered for 1 minute and is free.
  • The cache is shared across all customers, which is what keeps repeat calls cheap.

What can go wrong#

StatusCodeWhat to do
401unauthorizedCheck the x-api-key header.
402insufficient_creditsAdd credits; your balance must cover the price.
404not_foundUnknown endpoint path.
422invalid_paramsFix the parameters using the table above. Free.
429rate_limitedWait Retry-After seconds, then retry.
502upstream_errorThe source failed. Refunded; retry with backoff.

See Errors for the full list and retry guidance.

Status: stable (verified against the live source).