Search HackerNews

Search HackerNews stories and comments (via Algolia's HN index).

Query syntax

query supports HN's native search qualifiers in addition to plain keywords: author:USERNAME / by:USERNAME (filter by author), story:ID (filter to one story's items), points>N / points<N, comments>N / comments<N, "exact phrase", and -word (exclude). A query can be qualifiers-only with no keywords, e.g. author:pg points>500.

Credits

Each successful response deducts 2 credits from your organization. Requests that fail (4xx / 5xx) are not billed.

See the credits documentation for the full rate table.


POST
/data/hackernews/search

Authorization

bearerAuth
AuthorizationBearer <token>

Organization API key from Integrations → API keys.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for POST /data/hackernews/search.

query*string

Search keywords for HackerNews stories/comments. Also supports HN's native search qualifiers: author:USERNAME or by:USERNAME (filter by author), story:ID (filter to one story's items), points>N / points<N (filter by points), comments>N / comments<N (filter by comment count), "exact phrase", and -word (exclude a word). Can be qualifiers-only with no keywords, e.g. "author:pg points>500".

Length1 <= length <= 200
tags?array<>

Restrict to stories, comments, or both (default both).

page?integer

Zero-indexed page number for pagination.

Range0 <= value
hitsPerPage?integer

Results per page (capped at 100).

Range1 <= value <= 100

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/data/hackernews/search" \  -H "Content-Type: application/json" \  -d '{    "query": "string"  }'
{  "requestId": "string",  "posts": [    {      "objectID": "string",      "type": "story",      "title": "string",      "body": "string",      "url": "string",      "author": "string",      "points": 0,      "numComments": 0,      "createdAt": "string",      "storyId": "string",      "storyTitle": "string"    }  ],  "meta": {    "returnedCount": 0,    "hasMore": true,    "nextPage": 0  }}
{  "requestId": "01HXYZABCDEF",  "error": {    "code": "validation_error",    "message": "query: String must contain at least 1 character(s)",    "issues": [      {        "path": "query",        "message": "String must contain at least 1 character(s)"      }    ]  }}
{  "requestId": "01HXYZABCDEF",  "error": {    "code": "unauthorized",    "message": "Invalid or revoked API key."  }}
{  "requestId": "01HXYZABCDEF",  "error": {    "code": "rate_limited",    "message": "Rate limit exceeded for linkedin. Try again later.",    "retryAfter": 42  }}
{  "requestId": "01HXYZABCDEF",  "error": {    "code": "upstream_error",    "message": "Upstream request failed."  }}