API · Hacker News
GET /hackernews/search
Search Hacker News stories or comments, by relevance or date.
| Request | GET /v1/hackernews/search |
| Operation id | hackernews.search.stories |
| Cost | 1 credit, refunded if the call fails |
| Auth | API key: Authorization: Bearer <key> or x-api-key. |
Search Hacker News stories or comments, by relevance or date.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | yes | Search terms. Example: rust. |
tags | string | no | Algolia tags. Defaults to story. |
numericFilters | string | no | e.g. points>100,created_at_i>1700000000 |
sort | "relevance" | "date" | no | relevance (default) or date. One of relevance, date. |
hitsPerPage | integer | no | Hits per page, 1 to 1000. Defaults to 30. |
page | integer | null | no | Page number, 0 to 999 (0 is the first page). Defaults to 0. |
since | string | no | Only rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01. |
until | string | no | Only rows published on or before this date: YYYY-MM-DD (that whole UTC day) or an ISO 8601 timestamp. Example: 2026-12-31. |
Responses
| Status | Meaning | Schema |
|---|---|---|
200 | Matching items, with paging totals. | HackerNewsSearch |
400 | Invalid input. Nothing was charged. | Error |
401 | Missing or invalid API key. | Error |
402 | Not enough credits, a spend cap was reached, or payment is required. | Error |
403 | The target is private, or the account is suspended. | Error |
404 | The item or user does not exist. | Error |
429 | Too many requests. Wait for Retry-After seconds. | Error |
503 | Hacker News is temporarily unavailable. Retryable; nothing was charged. | Error |
HackerNewsSearch fields
| Field | Type | Description |
|---|---|---|
hits | HackerNewsSearchHit[] | |
nbHits | integer | |
page | integer | |
nbPages | integer | |
hitsPerPage | integer | |
query | string |
Errors use one shape everywhere; see Errors for every code and what to do.