hackernews
hackernews
contains codeHacker News API — read-only access to stories, comments, polls, jobs, users, and live feeds from news.ycombinator.com
Source: Hacker News API (Firebase)
Coverage
100% (11 of ~11 endpoints)
Focus: items (stories, comments, polls, jobs), users, story feeds (top, new, best, ask, show, job), updates, max item ID
Missing: none — full coverage of the public Firebase API
Setup
- No credentials required — the Hacker News API is fully public
- No signup or API key needed
Completely public API — no authentication, no API keys, no rate limit headers. Be respectful with request volume. The API is backed by Firebase and returns JSON for all endpoints. Append .json to all paths. For real-time updates consider the Firebase SDK (Server-Sent Events) instead of polling.
Install
Add to your backends.yaml:
- name: hackernews
transport: rest
dadl: hackernews.dadl
url: "https://hacker-news.firebaseio.com/v0"
Set the credential:
CREDENTIAL_HACKERNEWS_TOKEN=your-token-here Tools (10)
GET get_item Get any item by ID. Items are polymorphic — the "type" field indicates whether it is a story, comment, job, poll, or pollopt. Returns null for non-existent IDs. Key fields: id, type, by, time, text, url, score, title, kids (child comment IDs), parent, descendants (total comment count for stories), deleted, dead.
GET get_user Get a user profile by username. Returns karma, creation date, about (HTML bio), and submitted (array of all item IDs the user has posted). Username is case-sensitive. Returns null for non-existent users.
GET get_top_stories Get up to 500 top story IDs, ordered by ranking on the HN front page. Returns an array of integer item IDs — call get_item for full details.
GET get_new_stories Get up to 500 newest story IDs, ordered by submission time (newest first). Returns an array of integer item IDs — call get_item for full details.
GET get_best_stories Get up to 500 best story IDs (all-time highest-voted recent stories). Returns an array of integer item IDs — call get_item for full details.
GET get_ask_stories Get up to 200 latest Ask HN story IDs. These are posts where users ask the HN community a question. Returns an array of integer item IDs.
GET get_show_stories Get up to 200 latest Show HN story IDs. These are posts where users showcase their projects to the HN community. Returns an array of integer item IDs.
GET get_job_stories Get up to 200 latest job posting IDs from the HN jobs board. Returns an array of integer item IDs.
GET get_max_item Get the current largest item ID. Useful for polling: fetch items between your last known ID and max ID to catch new submissions. Returns a single integer.
GET get_updates Get recently changed item IDs and user profiles. Returns an object with "items" (array of changed item IDs) and "profiles" (array of changed usernames). Useful for building a polling-based sync.
Composites (3) ⚠ contains code
FN get_top_stories_full Get the top N stories with full item details (default: 10). Fetches story IDs then resolves each to its full item object. FN get_story_with_comments Get a story and its top-level comments resolved to full item objects. Returns the story with a 'comments' array containing the full comment items. FN get_user_stories Get a user's most recent stories (not comments). Fetches the user profile, then resolves their most recent submitted items and filters to type=story. Scans 20 recent submissions to stay within the 50-call sandbox limit — users who mostly post comments may return fewer stories than the limit.