Hacker News search vs story comments: which endpoint to call
hackernews.search finds stories and comments by text; hackernews.story_comments returns one story's full thread. What each returns and costs.
The Hacker News endpoints come from two upstreams: HN Search (full-text, by relevance or date) and the official Firebase item API (one item and its thread).
| Endpoint | What it does | Price | Output fields |
|---|---|---|---|
| hackernews.search | Full-text search of Hacker News stories and comments, by relevance or date. | $0.0015 per request ($1.50 per 1,000) | results, total |
| hackernews.story | One Hacker News item (story, comment, job or poll) by id. | $0.0015 per request ($1.50 per 1,000) | title, points, num_comments, url |
| hackernews.story_comments | The full comment thread of a Hacker News story, flattened with depth. | $0.0015 per request ($1.50 per 1,000) | comments |
Which one to call
| If | Call |
|---|---|
| You need stories or comments that mention a word | hackernews.search |
| You have a story id and need its title, score and link | hackernews.story |
| You have a story id and need the whole discussion | hackernews.story_comments |
hackernews.search
curl -s -X POST https://getallapis.com/v1/run/hackernews.search \
-H "Authorization: Bearer $GETALLAPIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"postgres","limit":10}'
Get an API key. New API keys come with $0.10 of free credit, no card required (limited to 2 keys per network every 30 days). That covers about 66 requests of hackernews.search. Then add credits (packs from $10). No subscription; failed calls are refunded.