Docs
View as Markdown

hackernews.ask_hn

stable Advanced

Latest Ask HN posts.

GET /v1/hackernews/ask_hn

What you get#

A list of Hacker News 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.

Pagination: 20 results per page. The response carries a pagination block; send its next_cursor back as the cursor parameter to get the next page. Every page is one call at the price below. See Pagination.

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
cursorstringno-Opaque cursor from a previous response's pagination.next_cursor. Omit for the first page.-

Request#

curl "https://api.onekey.dev/v1/hackernews/ask_hn" \
  -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 Hacker News response, recorded and returned in Onekey's shape. Fields the platform does not provide are null.

json
{
  "success": true,
  "data": [
    {
      "content": {
        "id": "37392676",
        "title": "Ask HN: I’m an FCC Commissioner proposing regulation of IoT security updates",
        "url": null,
        "text": "Hi everyone, I’m FCC Commissioner Nathan Simington, and I’m here to discuss security updates for IoT devices and how you can make a difference by filing comments with the FCC. As you know, serious vulnerabilities are common in IoT, and it often takes too long for these to be patched on end-user devices—if the manufacturer even bothers to release an update, and if the device was even designed to receive them. Companies may stop supporting a device well before consumers have stopped using it. The support period is often not communicated at the time of sale. And sometimes the end of support is not even announced, leaving even informed users unsure whether their devices are still safe. I’ve advocated for the FCC to require device manufacturers to support their devices with security updates for a reasonable amount of time [1]. I can't bring such a proposal to a vote since I’m not the chairman of the agency. But I was able to convince my colleagues to tentatively support something a little more moderate addressing this problem. The FCC recently issued a Notice of Proposed Rulemaking [2] for a cybersecurity labeling program for connected devices. If they meet certain criteria for the security of their product, manufacturers can put an FCC cybersecurity label on it. I fought hard for one of these criteria to be the disclosure of how long the product will receive security updates. I hope that, besides arming consumers with better information, the commitments on this label (",
        "createdAt": "2023-09-05T15:07:21Z"
      },
      "author": {
        "username": "SimingtonFCC"
      },
      "engagement": {
        "likes": 3387,
        "comments": 925
      }
    },
    {
      "content": {
        "id": "22918980",
        "title": "Ask HN: I'm a software engineer going blind, how should I prepare?",
        "url": null,
        "text": "I'm a 24 y/o full stack engineer (I know some of you are rolling your eyes right now, just highlighting that I have experience on frontend apps as well as backend architecture). I've been working professionally for ~7 years building mostly javascript projects but also some PHP. Two years ago I was diagnosed with a condition called \"Usher's Syndrome\" - characterized by hearing loss, balance issues, and progressive vision loss. I know there are blind software engineers out there. My main questions are: - Are there blind frontend engineers? - What kinds of software engineering lend themselves to someone with limited vision? Backend only? - Besides a screen reader, what are some of the best tools for building software with limited vision? - Does your company employ blind engineers? How well does it work? What kind of engineer are they? I'm really trying to get ahead of this thing and prepare myself as my vision is degrading rather quickly. I'm not sure what I can do if I can't do SE as I don't have any formal education in anything. I've worked really hard to get to where I am and don't want it to go to waste. Thank you for any input, and stay safe out there! Edit: Thank you all for your links, suggestions, and moral support, I really appreciate it. Since my diagnosis I've slowly developed a crippling anxiety centered around a feeling that I need to figure out the rest of my life before it's to",
        "createdAt": "2020-04-19T21:33:46Z"
      },
      "author": {
        "username": "zachrip"
      },
      "engagement": {
        "likes": 3270,
        "comments": 473
      }
    }
  ],
  "metadata": {
    "platform": "hackernews",
    "endpoint": "ask_hn",
    "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
objectIDcontent.id-
authorauthor.username-
titlecontent.title-
urlcontent.urlsafeUrl
story_textcontent.textstripHtml
created_atcontent.createdAttoIsoDate
pointsengagement.likestoNumber
num_commentsengagement.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).