TL;DR
The Hacker News API provides programmatic access to the Y Combinator-powered social news platform. Get top stories, new submissions, best stories, Ask HN, Show HN, and job listings. Each item includes title, URL, score, author, timestamp, comment count, and nested comments. User data includes karma, account age, and submitted stories. The API uses Firebase's official HN data source — completely unrestricted, no API key, no rate limits worth worrying about. Building a tech news aggregator or hacker community tool starts here.
Quick start: https://hacker-news.firebaseio.com/v0/topstories.json
No API key needed — just make a request!
https://hacker-news.firebaseio.com/v0/topstories.json
How to Use This API
1. Get Top Stories (IDs only)
https://hacker-news.firebaseio.com/v0/topstories.json
2. Get a Specific Story
https://hacker-news.firebaseio.com/v0/item/12345678.json
3. New, Best, Ask, Show, Jobs
https://hacker-news.firebaseio.com/v0/newstories.json
https://hacker-news.firebaseio.com/v0/beststories.json
https://hacker-news.firebaseio.com/v0/askstories.json
https://hacker-news.firebaseio.com/v0/showstories.json
https://hacker-news.firebaseio.com/v0/jobstories.json
4. Get User Profile
https://hacker-news.firebaseio.com/v0/user/jl.json
5. JavaScript — Top 5 Headlines
async function topHeadlines() {
const ids = await (await fetch(
'https://hacker-news.firebaseio.com/v0/topstories.json'
)).json();
const top5 = ids.slice(0, 5);
const stories = await Promise.all(
top5.map(id => fetch(
`https://hacker-news.firebaseio.com/v0/item/${id}.json`
).then(r => r.json()))
);
stories.forEach((s, i) => {
const score = s.score;
const title = s.title;
const by = s.by;
const comments = s.descendants ?? 0;
console.log(`${i + 1}. [${score} pts] ${title}`);
console.log(` by ${by} — ${comments} comments`);
});
}
topHeadlines();
6. Python — HN Job Board
import requests
def hacker_news_jobs():
job_ids = requests.get(
'https://hacker-news.firebaseio.com/v0/jobstories.json'
).json()
print("Recent Hacker News job postings:")
for job_id in job_ids[:10]:
job = requests.get(
f'https://hacker-news.firebaseio.com/v0/item/{job_id}.json'
).json()
title = job.get('title', 'Untitled')
url = job.get('url', '')
score = job.get('score', 0)
print(f' • {title}')
if url:
print(f' {url}')
print(f' Score: {score}')
hacker_news_jobs()
Frequently Asked Questions
- Do I need an API key?
- No. The HN API is completely open with no authentication — it's powered by Firebase and is the official API for Hacker News.
- What's the rate limit?
- There are no official rate limits, though very aggressive polling is discouraged. Firebase handles millions of requests per day for this API.
- What data is available per item?
- ID, deleted status, type (story/comment/job), author, timestamp, score, title, URL, text (for Ask HN), descendants (comment count), and kids (comment IDs).
- How do I get the full comment tree?
- Each item has a
kidsarray with comment IDs. Recursively fetch each comment item to build the full thread. Each comment has its ownkidsfor replies. - Is there search functionality?
- The Firebase API doesn't include search. For full-text search, use Algolia's HN Search API at
https://hn.algolia.com/api/v1. - How often is data updated?
- Real-time. The API reflects live Hacker News data — new stories, comments, and votes appear as they happen.
API Details
- API URL
https://hacker-news.firebaseio.com/v0/- Documentation
- github.com/HackerNews/API
- Category
- News
- Authentication
- Not Required
- Geographic Coverage
- Global — tech news and discussion
What You Can Build
- Alternative HN reader with custom filtering and sorting
- Tech news dashboard combining HN with other sources
- Discord or Slack bot that posts top HN stories
- Job board aggregator highlighting YC startup positions
- Karma tracker showing your HN profile analytics