Logo

Hacker News

Authentication Type: None Description: Search stories and comments, retrieve articles and user profiles from Hacker News via the Algolia-powered API.


Authentication

No authentication required. The Hacker News API is public and free to use.


Search

Search Hacker News for stories, comments, and other content. Results are powered by the Algolia search API.

Operation Type: Query (Read)

Parameters:

  • query string (required): The search query to find matching stories, comments, or other content on Hacker News.
  • tags string (nullable): Filter results by type. Supported values: story, comment, ask_hn, show_hn, front_page. You can combine tags with commas for AND filtering.
  • sortByDate boolean (nullable): If true, results are sorted by date (most recent first). If false or omitted, results are sorted by relevance.
  • maxResults number (nullable): Maximum number of results to return. Default 20.

Returns:

  • results array of objects: List of matching items
    • objectID string: The unique Hacker News item ID
    • title string: The title of the story (if applicable)
    • url string: The URL the story links to (if applicable)
    • author string: The username of the author
    • points number: The score / upvote count
    • num_comments number: The number of comments on the item
    • created_at string: ISO 8601 timestamp of when the item was created
    • story_text string: The body text of the story (for text posts like Ask HN)
  • totalHits number: The total number of results matching the query

Example Usage:

{
  "query": "large language models",
  "tags": "story",
  "sortByDate": true,
  "maxResults": 10
}

Articles

Get Article

Retrieve a single Hacker News article by its ID, including its comment tree.

Operation Type: Query (Read)

Parameters:

  • articleId string (required): The Hacker News item ID of the article to retrieve (e.g., "8863")

Returns:

  • id string: The Hacker News item ID
  • title string: The title of the article
  • url string: The URL the article links to
  • author string: The username of the author
  • points number: The score / upvote count
  • created_at string: ISO 8601 timestamp of when the article was posted
  • text string: The body text of the article (for text posts)
  • children array of objects: The comment tree for this article, with nested replies

Example Usage:

{
  "articleId": "8863"
}

Users

Get User

Retrieve a Hacker News user profile by username.

Operation Type: Query (Read)

Parameters:

  • username string (required): The Hacker News username to look up (e.g., "pg")

Returns:

  • username string: The user's Hacker News username
  • about string: The user's self-description / bio (may contain HTML)
  • karma number: The user's karma score
  • created_at string: ISO 8601 timestamp of when the account was created
  • objectID string: The unique identifier for the user

Example Usage:

{
  "username": "pg"
}

Common Use Cases

Competitive Intelligence:

  • Monitor mentions of your company or competitors on Hacker News
  • Track how often your brand appears in stories and comments
  • Analyze sentiment and discussion around competitor product launches

Content Research:

  • Find trending discussions about your industry or technology stack
  • Discover popular articles and blog posts in your domain
  • Identify frequently discussed pain points and feature requests

Lead Discovery:

  • Find users who post about topics relevant to your product
  • Identify active commenters in your industry vertical
  • Look up user profiles to understand their interests and engagement level

Market Research:

  • Track what tech topics are trending over time using date-sorted searches
  • Monitor Ask HN and Show HN posts for emerging tools and products
  • Analyze front page stories to understand what resonates with the developer community