# Substack Posts (`substack.posts`)

Recent posts of any Substack publication (or one post by URL): metadata, paywall status, engagement, author and the article body as HTML, Markdown and text.

Docs: https://primaryapi.com/docs/api-reference/substack/posts

- Endpoint: `POST https://api.primaryapi.com/v1/run/substack.posts`
- Category: Social · Platform: `substack` · Kind: list · Status: live
- Price: 1 credit per call; up to 19 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=substack.posts`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `url` | string | yes |  | max 2048 chars | A Substack publication URL or custom domain to list its recent posts (e.g. https://thezvi.substack.com or https://www.astralcodexten.com), OR a single post URL (…/p/<slug>) to fetch just that article. |
| `limit` | integer | no | 25 | 1–100 | Maximum number of recent posts to scan for a publication URL (1-100, default 25); ignored for a single post URL. Billed per post returned. |
| `contentType` | enum | no | "all" | one of: all, newsletter, podcast, thread | Restrict to one post type, or 'all'. |
| `includeContent` | boolean | no | true |  | Include the article body as HTML, Markdown and text. Set false for metadata only (faster). |
| `includeComments` | boolean | no | false |  | Include public comment threads with their direct replies on each post. |
| `maxComments` | integer | no | 20 | 0–500 | Maximum comments (top-level + direct replies) per post when includeComments is true (0-500, default 20; 0 = none). No extra charge. |
| `minComments` | integer | no |  | ≥ 0 | Only return posts with at least this many comments. |
| `minReactions` | integer | no |  | ≥ 0 | Only return posts with at least this many reactions. |
| `minWordCount` | integer | no |  | ≥ 0 | Only return posts with at least this many words (filters out short notes). |
| `onlyFree` | boolean | no | false |  | Return only free (non-paywalled) posts. |
| `startDate` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | Only posts published on or after this date (YYYY-MM-DD), applied within the most recent `limit` posts scanned. |
| `endDate` | string | no |  | pattern: ^\d{4}-\d{2}-\d{2}$ | Only posts published on or before this date (YYYY-MM-DD), applied within the most recent `limit` posts scanned. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `items` | object[] |  |
| `items[].postId` | string \| null | Substack post id |
| `items[].title` | string \| null |  |
| `items[].subtitle` | string \| null |  |
| `items[].slug` | string \| null |  |
| `items[].url` | string |  |
| `items[].createdUtc` | integer \| null | Publication time, UTC epoch seconds |
| `items[].updatedUtc` | integer \| null |  |
| `items[].description` | string \| null |  |
| `items[].image` | string \| null | Cover image URL |
| `items[].postType` | string \| null | newsletter \| podcast \| thread |
| `items[].isPaid` | boolean \| null | true when the post is restricted to paying subscribers |
| `items[].contentStatus` | enum | full body · truncated (paywalled preview) · feed (as published in RSS) · unavailable · omitted (includeContent=false) |
| `items[].wordcount` | integer \| null |  |
| `items[].reactionCount` | integer \| null |  |
| `items[].commentCount` | integer \| null |  |
| `items[].restackCount` | integer \| null |  |
| `items[].authorName` | string \| null |  |
| `items[].authorHandle` | string \| null |  |
| `items[].authorImage` | string \| null |  |
| `items[].authorBio` | string \| null |  |
| `items[].authorUrl` | string \| null |  |
| `items[].publication` | object |  |
| `items[].publication.id` | string \| null |  |
| `items[].publication.name` | string \| null |  |
| `items[].publication.url` | string \| null |  |
| `items[].language` | string \| null |  |
| `items[].html` | string \| null |  |
| `items[].markdown` | string \| null |  |
| `items[].text` | string \| null |  |
| `items[].podcastUrl` | string \| null |  |
| `items[].hasVoiceover` | boolean \| null |  |
| `items[].comments` | object[] |  |
| `items[].comments[].id` | string |  |
| `items[].comments[].authorName` | string \| null |  |
| `items[].comments[].authorHandle` | string \| null |  |
| `items[].comments[].authorImage` | string \| null |  |
| `items[].comments[].text` | string \| null |  |
| `items[].comments[].createdUtc` | integer \| null | UTC epoch seconds |
| `items[].comments[].reactionCount` | integer \| null |  |
| `items[].comments[].replyCount` | integer \| null |  |
| `items[].comments[].replies` | object[] | Direct replies |
| `items[].comments[].replies[].id` | string |  |
| `items[].comments[].replies[].authorName` | string \| null |  |
| `items[].comments[].replies[].authorHandle` | string \| null |  |
| `items[].comments[].replies[].authorImage` | string \| null |  |
| `items[].comments[].replies[].text` | string \| null |  |
| `items[].comments[].replies[].createdUtc` | integer \| null | UTC epoch seconds |
| `items[].comments[].replies[].reactionCount` | integer \| null |  |
| `items[].comments[].replies[].replyCount` | integer \| null |  |
| `nextCursor` | string \| null | Always null (raise `limit` to scan further back) |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/substack.posts" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://thezvi.substack.com","limit":5}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "items": [
        {
          "postId": "string",
          "title": "string",
          "subtitle": "string",
          "slug": "string",
          "url": "https://thezvi.substack.com",
          "createdUtc": 0,
          "updatedUtc": 0,
          "description": "string",
          "image": "string",
          "postType": "string",
          "isPaid": true,
          "contentStatus": "full",
          "wordcount": 0,
          "reactionCount": 0,
          "commentCount": 0,
          "restackCount": 0,
          "authorName": "string",
          "authorHandle": "string",
          "authorImage": "string",
          "authorBio": "string",
          "authorUrl": "https://example.com",
          "publication": {
            "id": "string",
            "name": "string",
            "url": "https://thezvi.substack.com"
          },
          "language": "string",
          "html": "string",
          "markdown": "string",
          "text": "string",
          "podcastUrl": "https://example.com",
          "hasVoiceover": true,
          "comments": [
            {
              "id": "string",
              "authorName": "string",
              "authorHandle": "string",
              "authorImage": "string",
              "text": "string",
              "createdUtc": 0,
              "reactionCount": 0,
              "replyCount": 0,
              "replies": [
                {
                  "id": null,
                  "authorName": null,
                  "authorHandle": null,
                  "authorImage": null,
                  "text": null,
                  "createdUtc": null,
                  "reactionCount": null,
                  "replyCount": null
                }
              ]
            }
          ]
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: up to 19 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=substack.posts`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Notes

Paid posts only expose the free preview (contentStatus "truncated").

## Legal

Newsletter bodies are copyrighted by their authors. Only content a logged-out reader can see is returned (paid posts are truncated). Customers must have the rights required for their use.

