# Substack API

> Returns Substack posts, comments, writer profiles, directory categories and the newsletters within each category.

Category: News & Media. Region: global. 7 endpoints at `https://api.hoshime.com/v1/substack/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/substack
## GET /v1/substack/archive

Latest or most liked posts of one Substack publication.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `publication` | string | yes | Publication subdomain, such as astralcodexten for astralcodexten.substack.com. (e.g. astralcodexten) |
| `sort` | string | no | new for the newest posts, top for the most liked. (one of new, top; default new; e.g. top) |
| `limit` | integer | no | Number of posts, from 1 to 25. (default 10) |
| `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: `audience` (string), `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `authors` (Author[]), `authors[].avatarUrl` (string), `authors[].id` (string), `authors[].name` (string), `authors[].url` (string), `authors[].username` (string), `id` (string), `imageUrl` (string), `publishedAt` (string), `slug` (string), `source` (string), `subtitle` (string), `summary` (string), `title` (string), `url` (string), `wordCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/substack/archive?publication=astralcodexten&sort=top" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/substack/search

Posts of one Substack publication that match the words of a search, newest first.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `publication` | string | yes | Publication subdomain, such as astralcodexten for astralcodexten.substack.com. (e.g. astralcodexten) |
| `query` | string | yes | Words to search for in the posts, such as monosemanticity. (e.g. monosemanticity) |
| `limit` | integer | no | Number of posts, from 1 to 25. (default 10) |
| `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: `audience` (string), `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `authors` (Author[]), `authors[].avatarUrl` (string), `authors[].id` (string), `authors[].name` (string), `authors[].url` (string), `authors[].username` (string), `id` (string), `imageUrl` (string), `publishedAt` (string), `slug` (string), `source` (string), `subtitle` (string), `summary` (string), `title` (string), `url` (string), `wordCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/substack/search?publication=astralcodexten&query=monosemanticity" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/substack/post

One post of a Substack publication by its slug.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `publication` | string | yes | Publication subdomain, such as astralcodexten for astralcodexten.substack.com. (e.g. astralcodexten) |
| `slug` | string | yes | Post slug, the last part of its URL, such as the-dilbert-afterlife. (e.g. the-dilbert-afterlife) |
| `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: `audience` (string), `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `authors` (Author[]), `authors[].avatarUrl` (string), `authors[].id` (string), `authors[].name` (string), `authors[].url` (string), `authors[].username` (string), `id` (string), `imageUrl` (string), `publishedAt` (string), `slug` (string), `source` (string), `subtitle` (string), `summary` (string), `title` (string), `url` (string), `wordCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/substack/post?publication=astralcodexten&slug=the-dilbert-afterlife" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/substack/comments

Top-level comments on one post, with the number of replies under each. Replies are not expanded.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `publication` | string | yes | Publication subdomain, such as astralcodexten for astralcodexten.substack.com. (e.g. astralcodexten) |
| `id` | integer | yes | Post id, as the archive and post endpoints give it, such as 184503512. (e.g. 184503512) |
| `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), `createdAt` (string), `id` (string), `likeCount` (integer (int64)), `replyCount` (integer (int64)), `text` (string)

```bash
curl "https://api.hoshime.com/v1/substack/comments?publication=astralcodexten&id=184503512" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/substack/user

Public profile of a Substack writer: name, bio and follower count.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `handle` | string | yes | Substack handle, such as astralcodexten, from a profile URL substack.com/@astralcodexten. (e.g. astralcodexten) |
| `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), `name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/substack/user?handle=astralcodexten" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/substack/categories

Newsletter categories Substack lists in its directory, with their ids for categoryPublications.

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

| 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), `name` (string), `parentId` (string), `slug` (string)

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

## GET /v1/substack/categoryPublications

Newsletters in one Substack directory category, 25 per page.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | Category id from categories, such as 96 for Culture. (e.g. 96) |
| `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` (string), `heroText` (string), `id` (string), `logoUrl` (string), `name` (string), `subdomain` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/substack/categoryPublications?id=96" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
