HackerNews API

Beginner's Pick Social / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)
95 A+
Measured Score 0 50 100 Reachability 30/30 Speed 15/20 Security 15/15 Developer XP 20/20 Reliability 15/15 TESTED 2026-07-23

Overview

The Hacker News API gives you free, real-time access to the stories, comments, jobs, and polls from the popular tech news community. No authentication is required — you can start fetching top stories and their details with a simple GET request. It is an excellent beginner API for learning asynchronous data fetching since story items are retrieved individually by ID.

Beginner Tip

Start by fetching the topstories endpoint to get a list of up to 500 story IDs, then fetch individual items by ID. Keep in mind each story is a separate request, so use Promise.all() in JavaScript to fetch multiple items in parallel.

Available Data

article title and content
publication source
published date
article URL
image URL
IP address information

Example Response

JSON Response
{
  "totalArticles": 100,
  "articles": [
    {
      "title": "Tech Industry Sees Record Growth",
      "source": {
        "name": "TechNews",
        "url": "https://technews.com"
      },
      "publishedAt": "2025-01-15T08:00:00Z",
      "description": "The technology sector reported unprecedented growth...",
      "image": "https://example.com/article-image.jpg",
      "url": "https://technews.com/article/123"
    }
  ]
}

Field Reference

id The unique ID of the item on Hacker News
title The headline of the story or Ask HN post
url The external URL the story links to; absent for Ask HN posts
score Current upvote count for the story
by Username of the person who submitted the story
descendants Total number of comments on the story

Implementation Example

Request
// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://github.com/HackerNews/API";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Receiving only an array of numbers, not story data The top/new/beststories endpoints return only IDs, not full story objects
Take each ID from the array and make a separate GET request to /v0/item/{id}.json to retrieve the full story
null response for an item The item ID is valid but the item has been deleted or does not exist
Always null-check the response before accessing fields like item.title or item.url
Slow performance when fetching many stories Fetching stories sequentially one by one
Fetch multiple items in parallel using Promise.all() or equivalent concurrency patterns in your language

Measured Score Breakdown

Live HTTP request to the API endpoint

Reachability 30/30
Speed 15/20
Security 15/15
Developer XP 20/20
Reliability 15/15
Endpoint Response Time 426ms

Fully tested on Jul 23, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Social
Difficulty Beginner
Verified: 2026-04-04

Related Tags

Similar APIs

View All →