# Search Hacker News API

> Full-text + filter search over Hacker News (stories, comments, Show/Ask HN, front page) via Algolia's open API. Ordered by relevance or date.

Category: [Tools APIs](https://upapi.io/apis/tools) · Last updated 2026-06-12

## How to call it

- Endpoint: `POST https://api.upapi.io/hackernews-search.get`, key in the `X-Api-Key` header, JSON body.
- Cost: 1 weighted unit per call.
- Timeout: 20 seconds.
- Cache: identical requests are served from cache for 60 seconds, unbilled.
- Try it without writing code: https://app.upapi.io/try/hackernews-search.get

```bash
curl -X POST https://api.upapi.io/hackernews-search.get \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{ "tags": "story", "order": "relevance", "query": "typescript", "hitsPerPage": 20 }'
```

## Request parameters

- `tags` (string) — HN Algolia tag filter: story, comment, poll, show_hn, ask_hn, front_page, etc.
- `order` (string) — Sort order
- `query` (string, required) — Full-text search query
- `hitsPerPage` (integer)

## Response fields

- `hits` (array, required)
- `hits[].id` (string, required)
- `hits[].url` (string, required)
- `hits[].tags` (array, required)
- `hits[].title` (string, required)
- `hits[].author` (string, required)
- `hits[].points` (integer, required)
- `hits[].createdAt` (string, required)
- `hits[].storyText` (string, required)
- `hits[].numComments` (integer, required)
- `query` (string, required)
- `fetchedAt` (string, required)
- `totalHits` (integer, required)

## Example request and response

The example response is generated from the published output schema: it shows the shape and field names, not values from a recorded call.

```json
{
  "tags": "story",
  "order": "relevance",
  "query": "typescript",
  "hitsPerPage": 20
}
```

```json
{
  "hits": [
    {
      "id": "example",
      "url": "https://github.com",
      "tags": [
        "example"
      ],
      "title": "Alan Turing",
      "author": "example",
      "points": 1,
      "createdAt": "example",
      "storyText": "example",
      "numComments": 1
    }
  ],
  "query": "typescript",
  "fetchedAt": "example",
  "totalHits": 1
}
```

## Frequently asked questions

### How much does the Search Hacker News API cost per call?

Each call spends 1 weighted unit of your plan's monthly quota. Full pricing is at https://upapi.io/pricing.

### How do I authenticate to the Search Hacker News API?

Send your key in the X-Api-Key header. A free guest key is available without creating an account.

### Are Search Hacker News API responses cached?

Yes — identical requests are served from cache for 60 seconds, and a cache hit is not billed.

## More Tools APIs

- [Get Cloudflare Page Title](https://upapi.io/apis/tools/cloudflare-page-title)
- [Capture Website Screenshot](https://upapi.io/apis/tools/screenshot)
- [Extract Text from PDF](https://upapi.io/apis/tools/pdf-extract-text)
- [Fetch URL as Markdown](https://upapi.io/apis/tools/fetch-markdown)
- [OCR an Image](https://upapi.io/apis/tools/image-ocr)
- [Render HTML or URL to PDF](https://upapi.io/apis/tools/html-to-pdf)
