# Substack Posts API

> Pull posts from any Substack publication by its URL, or pass a single post URL (…/p/slug) to fetch just that one article. Returns title, subtitle, publish date, paywall status, word count, engagement (reactions, comments, restacks), author profile, publication details, the full article body as text, HTML and Markdown, and optional comment threads.

Source: https://www.sandbase.ai/apis/substack/posts
API reference: https://www.sandbase.ai/apis/substack/posts/docs

## Facts

- Provider: Substack
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/substack/posts`
- Price: From $0.04 per call
- Capabilities: api, substack, social media
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/substack/posts` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `url` | string | yes |  |
| `limit` | integer | no |  |
| `endDate` | string | no |  |
| `onlyFree` | boolean | no |  |
| `startDate` | string | no |  |
| `contentType` | string | no | all, newsletter, podcast, thread |
| `maxComments` | integer | no |  |
| `minComments` | integer | no |  |
| `minReactions` | integer | no |  |
| `minWordCount` | integer | no |  |
| `includeContent` | boolean | no |  |
| `includeComments` | boolean | no |  |

## FAQ

### How do I use the Substack Posts API?

Send a POST request to https://api.sandbase.ai/v1/api/substack/posts with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Substack Posts API cost?

From $0.04 per call, billed from your SandBase balance. You are only charged for calls you make; there is no subscription.

### What parameters does the Substack Posts API accept?

Required: url (string). Optional: limit (integer), endDate (string), onlyFree (boolean), startDate (string), contentType (one of all, newsletter, podcast, thread) and maxComments (integer) and 5 more. The Parameters table and the Playground on this page list every field.

### What does the Substack Posts API return?

A JSON response returned in the same HTTP request (synchronous).

### Do I need a Substack developer account or API key?

No. Substack Posts runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Substack API access separately.

## README

### Substack Posts API

Pull posts from any Substack publication by its URL, or pass a single post URL (…/p/slug) to fetch just that one article. Returns title, subtitle, publish date, paywall status, word count, engagement (reactions, comments, restacks), author profile, publication details, the full article body as text, HTML and Markdown, and optional comment threads.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/run" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "substack/posts", "url": "https://www.astralcodexten.com", "limit": 3}'
```

The result is returned in `outputs[0].data`. A lookup that finds nothing still succeeds and returns `found: false`.

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `url` | string | Yes | Either a Substack publication URL / custom domain to fetch its recent posts (e.g. https://www.astralcodexten.com), OR a single post URL to fetch just that one article with full content (e.g. https://www.astralcodexten.co |
| `contentType` | string | No | Restrict to a single post type, or 'all' (e.g. newsletter). One of: `all`, `newsletter`, `podcast`, `thread`. Default `"all"`. |
| `endDate` | string | No | Only return posts published on or before this date, format YYYY-MM-DD (e.g. 2024-12-31). Applied within the most recent 'limit' posts scanned. |
| `includeComments` | boolean | No | Include public comment threads and their direct replies on each post (e.g. true). Default `false`. |
| `includeContent` | boolean | No | Include the full article body as text, HTML and Markdown. Set false for metadata only, which is faster (e.g. false). Default `true`. |
| `limit` | integer | No | Maximum number of recent posts to return when given a publication URL (1-100, default 25); ignored for a single post URL, which always returns that one post. You are billed per post returned, so a lower limit costs less. |
| `maxComments` | integer | No | Maximum comments collected per post when 'includeComments' is true (0-500, default 20). Costs nothing extra (e.g. 50). |
| `minComments` | integer | No | Only return posts with at least this many comments (e.g. 10). |
| `minReactions` | integer | No | Only return posts with at least this many reactions (e.g. 100). |
| `minWordCount` | integer | No | Only return posts with at least this many words, which filters out short notes and announcements (e.g. 1000). |
| `onlyFree` | boolean | No | Return only free (non-paywalled) posts (e.g. true). Default `false`. |
| `startDate` | string | No | Only return posts published on or after this date, format YYYY-MM-DD (e.g. 2024-01-01). Applied within the most recent 'limit' posts scanned, so raise 'limit' to reach older date ranges. |

#### Pricing

Billed at the actual cost of each call, usually $0.0444 per request. A call can cost more when the first data source fails and another one answers. Failed calls are not charged. Lookups that find nothing and searches with no results are billed at their actual cost, which is often lower and can be $0.
