# Hacker News API

> Returns Hacker News stories, comments, user profiles, ranked story lists, newest item id and recent updates.

Category: Developer & Tech. Region: global. 6 endpoints at `https://api.hoshime.com/v1/hackernews/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/hackernews
## GET /v1/hackernews/search

Stories or comments that match a search, 20 per page, by relevance or newest first.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Search terms. (e.g. golang) |
| `sort` | string | no | relevance, or date for newest first. (one of relevance, date; default relevance) |
| `tags` | string | no | Algolia tags to match: story, comment, poll, show_hn, ask_hn, front_page or author_<name>. (default story) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `commentCount` (integer (int64)), `createdAt` (string), `id` (string), `points` (integer (int64)), `storyId` (string), `text` (string), `title` (string), `type` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/hackernews/search?query=golang" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hackernews/item

A story, poll or comment with its comment tree down to depth levels.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Item id or news.ycombinator.com item URL. (e.g. 8863) |
| `depth` | integer | no | Levels of comments to return: 0 for none, 1 for top-level comments. (default 1) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `commentCount` (integer (int64)), `comments` (Comment[]), `comments[].author` (Author), `comments[].comments` (Comment[]), `comments[].createdAt` (string), `comments[].id` (string), `comments[].likeCount` (integer (int64)), `comments[].replyCount` (integer (int64)), `comments[].text` (string), `createdAt` (string), `id` (string), `parentId` (string), `points` (integer (int64)), `text` (string), `title` (string), `type` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/hackernews/item?id=8863" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hackernews/user

Karma, bio and submission count of one account.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `username` | string | yes | Username or news.ycombinator.com user URL. (e.g. pg) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `avatarUrl` (string), `bio` (string), `createdAt` (string), `followerCount` (integer (int64)), `followingCount` (integer (int64)), `id` (string), `karma` (integer (int64)), `name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/hackernews/user?username=pg" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hackernews/top

Stories of the top, new, best, ask, show or job list, up to 30 at a time.

Scope: `social:read` · Units: 1 · Cached: 5 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `list` | string | no | Which list to read: top, new, best, ask (Ask HN), show (Show HN) or job. (one of top, new, best, ask, show, job; default top) |
| `limit` | integer | no | Items per page, 1 to 30. (default 10) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `commentCount` (integer (int64)), `id` (string), `imageUrl` (string), `points` (integer (int64)), `publishedAt` (string), `source` (string), `summary` (string), `title` (string), `type` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/hackernews/top" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hackernews/maxItem

Id of the newest item on Hacker News, for following new posts.

Scope: `social:read` · Units: 1 · Cached: 1 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string)

```bash
curl "https://api.hoshime.com/v1/hackernews/maxItem" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/hackernews/updates

Items and profiles that changed recently, as the official API lists them.

Scope: `social:read` · Units: 1 · Cached: 1 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `items` (string[]), `profiles` (string[])

```bash
curl "https://api.hoshime.com/v1/hackernews/updates" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
