# Hacker News Stories & Search API

> Hacker News Stories & Search API is a paid API for AI agents from hn.genexxis.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-30).

Fetches Hacker News front-page story lists (top, new, best, ask, show) or performs full-text search across HN stories, returning titles, URLs, points, comments, authors, and excerpts.

## Facts

- Endpoint: GET https://hn.genexxis.com/hackernews?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hacker-news-stories-search-api-970b8320
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_zyGtM71MNIbITRnQ0Trme

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability hacker-news-stories-search-api-970b8320
```

Example prompt: Can you search Hacker News for the top 10 most relevant stories about AI agents from the last 7 days, sorted by relevance?

## When to prefer this

Use this endpoint when you need structured, machine-readable Hacker News data including front-page rankings or full-text search with filtering by recency, tags (ask_hn, show_hn, front_page), and sort order. Prefer this over scraping HN directly or using the raw Algolia HN Search API when you want a clean, unified interface that handles both list modes and search in one call at low cost per request.

## Known failure modes

- Missing required 'q' parameter when mode=search returns an error
- Invalid mode value returns an error or defaults to 'top'
- maxItems outside 1-50 range may be clamped or rejected
- days parameter with non-numeric value may cause a query error
- HN API downtime causes upstream fetch failures
- Payment not provided or insufficient USDC returns 402

## How this service works

Hacker News stories: front-page lists (top, new, best, ask, show) or full-text search, each with title, URL, domain, points, comment count, author, time, HN link and text excerpt.

## Output

Returns a JSON object containing the mode/query used, a count of returned stories, and an array of story objects each with: numeric ID, title, URL, domain, author, creation timestamp, points, comment count, HN permalink, story type, and optional text excerpt. Also includes a totalMatches field for search mode.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "q": {
       "type": "string",
       "description": "Search query (required for mode=search)"
      },
      "days": {
       "type": "string",
       "description": "Search only: limit to stories from the last N days"
      },
      "mode": {
       "type": "string",
       "description": "top | new | best | ask | show | search (default top)"
      },
      "sort": {
       "type": "string",
       "description": "Search only: relevance | date (default relevance)"
      },
      "tags": {
       "type": "string",
       "description": "Search only: story | ask_hn | show_hn | front_page | comment (default story)"
      },
      "maxItems": {
       "type": "string",
       "description": "1-50, default 20"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "q": "ai agents",
  "mode": "search",
  "sort": "relevance",
  "count": 10,
  "errors": [],
  "stories": [
   {
    "id": 45678901,
    "url": "https://example.com/agent-tests",
    "type": "story",
    "hnUrl": "https://news.ycombinator.com/item?id=45678901",
    "title": "Show HN: An open-source tool for testing AI agents",
    "author": "jdoe",
    "domain": "example.com",
    "points": 412,
    "created": "2026-10-24T14:02:11.000Z",
    "excerpt": null,
    "comments": 187
   }
  ],
  "totalMatches": 20055
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hacker-news-stories-search-api-970b8320/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from hn.genexxis.com](https://www.zero.xyz/host/hn.genexxis.com/llms.txt)
