Hacker News

Search Hacker News

Search Hacker News by keyword.

GET/v1/hackernews/search
1credit
x-api-key*stringheader

API key (`sfk_...`)

Parameters
15
querystringquery

Full-text search query. Required unless `frontPageOnly`, `author`, `domain`, or `url` is set.

max 512 chars

typestringquery

Content type filter. Default: `all`.

one of: all, story, comment, ask_hn, show_hn, launch_hn, job, poll

sortstringquery

Ranking mode. Default: `popularity`.

one of: popularity, date

dateRangestringquery

Creation-time window. Default: `all`.

one of: 24h, week, month, year, all

pageintegerquery

Zero-based page index (maximum 50 pages, up to 1,000 hits).

≥ 0 · ≤ 49

pageSizeintegerquery

Hits per page. Default: 20.

frontPageOnlybooleanquery

When true, restrict results to current front-page items. Allows omitting `query`.

searchStoryTextbooleanquery

Include story/comment text in searchable fields. Default: true. Set false to search title/URL only.

searchAuthorbooleanquery

When true, include author username in the searchable fields.

prefixbooleanquery

When true, enable prefix matching for query tokens.

typoTolerancebooleanquery

Enable typo tolerance. Default: true.

authorstringquery

Restrict results to items by this Hacker News username.

min 1 chars · max 255 chars · pattern: ^[A-Za-z0-9_-]+$

domainstringquery

Restrict search to story URLs matching this domain (e.g. example.com). Can omit `query`.

min 1 chars · max 255 chars

urlstringquery

Restrict search to story URLs matching this URL substring. Can omit `query`.

min 1 chars · max 2048 chars

minPointsintegerquery

Minimum points/score filter.

≥ 0 · ≤ 1000000

Response fields
31

Endpoint-specific response payload.

dataquery
stringnullable

Search query evaluated for this response, or null for front-page-only.

Search hits for this page.

datahits[]id
integer

Hacker News item id.

≥ 0

datahits[]type
string

Normalized content type.

one of: story, comment, poll, job, pollopt, unknown

datahits[]author
stringnullable

Author username when present.

datahits[]createdAt
stringnullable

Creation time as an ISO-8601 timestamp.

datahits[]title
stringnullable

Plain-text title when present.

datahits[]text
stringnullable

Plain-text body when present (HTML stripped).

datahits[]url
stringnullable

External story URL when present and publicly safe.

datahits[]score
integernullable

Points / score when present.

datahits[]commentCount
integernullable

Comment count for stories when present.

datahits[]storyId
integernullable

Parent story id for comment hits when present.

≥ 0

datahits[]parentId
integernullable

Immediate parent item id when present.

≥ 0

Normalized content tags for this hit (e.g. story, ask_hn).

datahits[]tags[]
stringoptional

min 1 chars

datahits[]itemUrl
string

Canonical news.ycombinator.com item URL.

Pagination information for the current response.

datapagepage
integer

Zero-based page index for this response.

≥ 0

datapagepageSize
integer

Requested page size for this response.

≥ 0

datapagereturned
integer

Number of hits returned in this response.

≥ 0

datapagehasMore
boolean

Whether another page of results is available.

datapagenextPage
integernullable

Next page index when hasMore is true; otherwise null.

≥ 0

datapagetotalHits
integer

Reported total hit count from the search index.

≥ 0

datapagetotalHitsExact
boolean

Whether totalHits is exhaustive. When false, treat totalHits as an estimate.

datapagemaxAccessibleHits
integer

Hard upper bound on pageable hits from the search index (typically 1000).

≥ 0

Metadata describing the request and billing outcome.

metarequestId
string

Unique request identifier for tracing this API call.

min 1 chars

metacreditsCharged
integer

Credits charged for this request.

≥ 0

metaversion
string

Public API version that served the response.

one of: v1

metacached
booleanoptional

True when served from shared response cache. Credits still apply (full endpoint price); Age header may be present.

Code example

curl "https://api.socialfetch.dev/v1/hackernews/search?query=Dropbox" \
  -H "x-api-key: YOUR_API_KEY"

Responses

Hacker News search results.