What you get#
Onekey exposes Hacker News as 25 endpoints behind one API key: 4 endpoints return one record (data is an object) and 21 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 Hacker News also works for the rest of the messaging & communities category.
Endpoints#
| Endpoint | What it does | Parameters | Credits | Status |
|---|---|---|---|---|
ask_hn | Latest Ask HN posts. | cursor | 5 | stable |
askstories | Latest Ask HN story ids. | - | 5 | stable |
author_comments | Comments written by a Hacker News user. | user*, cursor | 5 | stable |
author_submissions | Stories submitted by a Hacker News user. | user*, cursor | 5 | stable |
beststories | Best story ids on Hacker News. | - | 5 | stable |
front_page | Hacker News front page (Algolia). | cursor | 5 | stable |
item | A Hacker News item (Algolia, with points and counts). | id* | 1 | stable |
item_comments | Top-level comments of a Hacker News item (children of the comment tree). | id* | 5 | stable |
item_firebase | A Hacker News item (official Firebase API). | id* | 1 | stable |
jobs | Hacker News job posts. | cursor | 5 | stable |
jobstories | Latest job story ids. | - | 5 | stable |
maxitem | Current maximum Hacker News item id. | - | 1 | stable |
newstories | Newest story ids on Hacker News. | - | 5 | stable |
polls | Hacker News polls. | cursor | 5 | stable |
search | Search Hacker News stories by keyword. | q*, cursor | 1 | stable |
search_by_date | Search Hacker News stories, newest first. | q*, cursor | 5 | stable |
search_comments | Search Hacker News comments. | q*, cursor | 5 | stable |
search_url | Stories that link to a URL or domain. | q*, cursor | 5 | stable |
show_hn | Latest Show HN posts. | cursor | 5 | stable |
showstories | Latest Show HN story ids. | - | 5 | stable |
story_comments | Comments of a Hacker News story (flat, newest first). | id*, cursor | 1 | stable |
topstories | Top story ids on Hacker News. | - | 5 | stable |
updated_profiles | Recently changed Hacker News usernames. | - | 5 | stable |
updates | Recently changed Hacker News item ids. | - | 5 | stable |
user | Fetch a Hacker News user profile. | username* | 1 | 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 hackernews.item (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/hackernews/item?id=8863" \
-H "x-api-key: YOUR_API_KEY"Fields you get back#
These unified fields come back from Hacker News, with the same names as on every other platform. The count is how many of its 25 mapped endpoints return the field; a field the source lacks is null, never missing. 1 platform-specific field (ext.<name>) come on top, documented on each endpoint page.
| Field | Type | Endpoints |
|---|---|---|
content.id | string | 23 |
author.username | string | 17 |
content.createdAt | ISO 8601 date | 15 |
content.text | string | 15 |
content.title | string | 14 |
content.url | URL | 14 |
engagement.likes | integer | 14 |
engagement.comments | integer | 10 |
content.threadId | string | 3 |
author.id | string | 2 |
content.parentId | string | 1 |
content.type | string | 1 |
The full schema is in Unified schema.
Pricing#
Hacker News 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.