Skip to content

algolia-hn-search

algolia-hn-search

contains code

Algolia Hacker News Search API — full-text search, filtering, and retrieval for stories, comments, and users on Hacker News

Source: Algolia HN Search API

Credits: Dunkel Cloud GmbH Updated: 2026-04-04

Coverage

100% (4 of ~4 endpoints)

Focus: full-text search (relevance and date), item retrieval with comment trees, user profiles

Missing: none — full coverage of the Algolia HN Search API

Last reviewed: 2026-04-04

Setup

  1. No credentials required — the Algolia HN Search API is fully public
  2. No signup or API key needed

Authentication docs ↗

Completely public API — no authentication, no API keys. Two search endpoints: /search (relevance) and /search_by_date (chronological). Use tags and numericFilters for precise filtering. The /items endpoint returns full nested comment trees, unlike the Firebase API.

Install

Add to your backends.yaml:

- name: algolia-hn-search
  transport: rest
  dadl: algolia-hn-search.dadl
  url: "https://hn.algolia.com/api/v1"

Set the credential:

CREDENTIAL_ALGOLIA_HN_SEARCH_TOKEN=your-token-here

Tools (4)

GET search Full-text search ranked by relevance (points, num_comments). Best for finding popular/relevant content. Returns hits with: objectID, title, url, author, points, num_comments, created_at, created_at_i, story_text, comment_text, _tags, _highlightResult. Also returns nbHits, page, nbPages, hitsPerPage at the top level.
GET search_by_date Full-text search ranked by date (newest first). Same parameters and response format as search, but results are sorted chronologically. Best for finding recent content or monitoring new submissions. Identical response fields to the search endpoint.
GET get_item Get an item by ID with its full nested comment tree. Unlike the Firebase API, this returns the complete children array with recursively nested comments already resolved. Each child has: id, created_at, author, text, points, children. The parent item also includes title, url, points, num_comments.
GET get_user Get a user profile by username. Returns: username, about (HTML bio), karma, created_at, avg, and other profile metadata. Username is case-sensitive.

Composites (5) ⚠ contains code

FN search_stories Search for stories only, returning a clean list with title, url, author, points, num_comments, and created_at. Convenience wrapper around search with tags=story.
FN search_recent_comments Search for recent comments matching a query, sorted by date (newest first). Returns comment text, author, story title, and timestamps.
FN get_front_page Get current HN front page stories with full details, sorted by relevance. Equivalent to browsing the HN homepage.
FN search_distilled LLM-optimized search that strips all Algolia metadata cruft before returning results. Implements the _clean_hit() pattern from hn-pulse: raw Algolia hits are ~2 KB each due to _highlightResult, _snippetResult, _rankingInfo, _tags, and other index-internal fields. This composite reduces each hit to ~200 bytes — only data an LLM actually needs. Supports both relevance (sort=relevance) and recency (sort=date) ranking, and all content types via the tags parameter. Designed as the primary search primitive for LangGraph-style ReAct agents that combine this Algolia backend with the Firebase HN backend (hackernews.dadl) for live enrichment.
FN get_user_activity Get a user's recent stories and comments. Fetches the user profile and their most recent submissions of each type.