# Substack Scraper & Research Archive — Markdown, JSON, CSV (`tubetext/substack-research-archive`) Actor

Collect publicly accessible Substack articles into source-linked Markdown, JSON, CSV and ZIP research packs. Full/preview labels, coverage reports and incremental collection. Full articles from $3/1,000 by tier, plus $0.005/GB startup (minimum one event). No article fee for previews. By TubeText.

- **URL**: https://apify.com/tubetext/substack-research-archive.md
- **Developed by:** [TubeText Labs](https://apify.com/tubetext) (community)
- **Features:** Full permissions
- **Stats:** 2 total users, 1 monthly users, 85.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 full article delivereds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Substack Scraper & Research Archive

Turn publicly accessible Substack articles into source-linked research files. Collect from publication archives or individual article URLs, then download Markdown, JSON, CSV and a ZIP bundle with access labels and a coverage report.

Built by **TubeText** for newsletter research, source collection and downstream document workflows. Each article retains its source link, author information when available, publication date and retrieval time. The Actor collects source material; it does not generate AI summaries.

**Pricing:** $4 per 1,000 new full articles on FREE, down to $3 on eligible paid tiers, plus startup from $0.005 at 512 MB. Full articles are charged after delivery to the Dataset; a later ZIP/export failure does not cancel that article fee. Previews and copied continuation records have no article fee. See the full price table and examples below.

### Quick start

1. Open the Actor in Apify Console and review its permissions and current pricing.
2. Add publication homepages to `publications`, or individual `/p/slug` links to `postUrls`. You can use both in one run.
3. Start with a small article and request budget. The default Apify timeout is 450 seconds for the default 300-second collection budget. Set a longer run timeout if you increase `maxRunSeconds`. Network requests stop at least 60 seconds before the platform deadline, reserving up to 30 seconds for charge confirmation and 30 seconds for export. Storage delays or a platform interruption can still prevent export completion.
4. When the run finishes, open `OUTPUT` in its default key-value store. Check `ready`, `complete` and `contentCounts`, then download `BUNDLE.zip` or the listed files.

This small example uses two article URLs from a content validation on October 23, 2026. Sources can change; the example does not guarantee that either article will remain accessible or retain the same access label.

```json
{
  "postUrls": [
    "https://simonw.substack.com/p/battle-drones-a-vibe-coded-rts-with",
    "https://www.lennysnewsletter.com/p/how-to-tell-if-a-startup-has-a-moat"
  ],
  "maxArticles": 4,
  "maxArticlesPerPublication": 2,
  "maxRequests": 12,
  "maxArchivePages": 2,
  "maxRunSeconds": 60,
  "maxDownloadMb": 5,
  "maxOutputMb": 3,
  "maxPackBytes": 200000,
  "groupBy": "publication-month",
  "onlyNew": false
}
```

For a publication archive, use a homepage, a Substack handle or a custom domain serving a Substack publication:

```json
{
  "publications": ["simonw"],
  "maxArticles": 10,
  "maxArticlesPerPublication": 10,
  "maxRequests": 30,
  "maxRunSeconds": 60,
  "groupBy": "publication-month",
  "onlyNew": false
}
```

The Actor does not accept Substack passwords, cookies or subscriber credentials. It retrieves what the source makes publicly accessible, including public previews of restricted articles.

### What you get

| Output | Use it for |
| --- | --- |
| Default Dataset | Article rows for API processing and Apify exports |
| `BUNDLE.zip` | Markdown packs plus `index.csv`, `articles.json`, `coverage.json` and a short `README.txt` |
| `INDEX.csv` | An article index with title, authors, date, publication, access label, source URL and content hash |
| `ARTICLES` | JSON array containing the consolidated article records and their source links |
| `COVERAGE` | Overall and per-source progress, failed URLs, pending items, filters, resource usage and stop reasons |
| `PACK-0001.md`, … | Research files grouped by publication or by publication and month; exact keys are listed in `OUTPUT.files.markdown` |
| `OUTPUT` | Delivery status, article counts and the exact files for this export |

Markdown packs repeat the article title, author, publication/retrieval dates, access label and source URL. Large articles may span several files to respect `maxPackBytes`. Splitting can interrupt Markdown formatting; the complete collected article body remains in `ARTICLES` and `articles.json`.

Images remain links. Embedded audio and video are represented as links when available and marked **not transcribed**. Media files are not downloaded. CSV cells that could be interpreted as spreadsheet formulas are prefixed to keep them as text.

#### Article fields

| Field | Meaning |
| --- | --- |
| `postId`, `slug`, `title` | Source article identity and title; `postId` is a string |
| `publication` | Canonical publication origin, such as `https://name.substack.com`; not a display name |
| `authors` | Names supplied by the source; may be an empty array |
| `publishedAt`, `retrievedAt` | UTC timestamps |
| `url` | Canonical article URL |
| `sourceUrls` | Inputs that led to the article, including overlapping publication and direct-post inputs |
| `contentStatus`, `audience` | Access label and the source's audience metadata, when supplied |
| `markdown`, `text` | Collected article body as Markdown and plain text |
| `contentHash` | SHA-256 of the collected Markdown; useful for comparing saved exports |
| `media` | Detected embedded media references; `transcriptStatus` is `not_processed` |

The Dataset is append-only. If another input later points to an already-added article, its Dataset row can have an older `sourceUrls` list. Use `ARTICLES` or the ZIP's `articles.json` for consolidated provenance.

### Full text, previews and coverage

| `contentStatus` | Interpretation |
| --- | --- |
| `full` | Nonempty returned body, source explicitly marked public, and no recognized restriction signal |
| `preview` | Nonempty returned body with a restriction, unlock or truncation signal; only the accessible portion is included |
| `unknown` | Nonempty body without enough access metadata to claim full text |
| `empty` | No usable accessible body |

These labels describe the observed source response. They are not a paywall bypass or an independent guarantee that a publisher returned its entire original article.

`OUTPUT.ready=true` means the listed export files were saved. It does not mean every requested source succeeded. Check `OUTPUT.complete` and `COVERAGE` separately, including when Apify reports the run as `SUCCEEDED`.

`complete=true` means the selected archive traversal or direct-post selection finished without pending work or unresolved source errors. It does **not** mean every article is `full`, or that the source endpoint exposes every historical post. In the two-URL validation above, the observed result was **2 articles: 1 full and 1 preview**, with `complete=true`.

If `complete=false`, read `COVERAGE.failed` and `COVERAGE.sources`. Each source reports discovered, filtered, previously delivered, duplicate, pending and failed counts, plus its stop reason. A global `stopReason` of `partial` can have a more specific per-source reason such as `page_limit`, `publication_limit`, `archive_error` or `repeated_page`.

### Input reference

Provide 1–100 unique sources in total. URLs must use public HTTPS addresses without embedded credentials or custom ports. Unknown input fields are rejected.

| Field | Default | Supported values / behavior |
| --- | --- | --- |
| `publications` | None | Array of publication homepages, `/archive` URLs, Substack handles or custom publication domains |
| `postUrls` | None | Array of individual `https://publication/p/slug` article URLs |
| `publishedAfter` | None | Inclusive lower bound: `YYYY-MM-DD` or a UTC ISO timestamp |
| `publishedBefore` | None | A date includes that full UTC day; a UTC ISO timestamp is exclusive |
| `groupBy` | `publication-month` | `publication-month` or `publication` |
| `onlyNew` | `false` | With `previousRunId`, skip IDs previously delivered as full text; recheck previews |
| `previousRunId` | None | Successful baseline run for incremental collection; requires `onlyNew=true` |
| `resumeFromRunId` | None | Finished run whose saved archive and unfinished work should be continued |
| `maxArticles` | `100` | 1–10,000 new article records per invocation, including preview/unknown/empty rows |
| `maxArticlesPerPublication` | `100` | 1–10,000 new records per input publication host per invocation |
| `maxRequests` | `500` | 1–20,000 HTTP requests, including redirects and retries |
| `maxArchivePages` | `100` | 1–1,000 archive pages per source per invocation |
| `maxRunSeconds` | `300` | 1–3,600 seconds for collection; checkpoint and export delivery can take additional time |
| `maxDownloadMb` | `50` | 1–500 MB of compressed HTTP response bodies; excludes headers, TLS and Apify storage traffic |
| `maxOutputMb` | `50` | 1–100 MB of serialized article data, including resumed records; derived exports and checkpoints add storage |
| `maxPackBytes` | `200000` | 1,200–2,000,000 UTF-8 bytes per Markdown file |

MB means 1,000,000 bytes here. Article limits count records, not paid results or guaranteed full-text articles. Without `publishedBefore`, collection uses the archive's initial snapshot time as its upper bound. Date filters do not guarantee fewer archive requests: the Actor still enumerates pages, including filtered and previously seen items.

### Incremental collection and continuation

| Goal | Input | Result |
| --- | --- | --- |
| Start an archive | Omit both history IDs | Collect selected accessible articles; `onlyNew` defaults to `false` |
| Collect additions and recheck previews | `onlyNew=true` plus `previousRunId` | Skip previously delivered full article IDs; output newly collected records, including rechecked previews |
| Finish an incomplete archive | `resumeFromRunId` | Copy saved articles and unfinished work, then continue in a new run; the bundle includes saved and newly collected articles |

For an incremental run, start with the same sources, date filters and grouping as the baseline, then set:

```json
{
  "publications": ["simonw"],
  "maxArticles": 10,
  "maxArticlesPerPublication": 10,
  "maxRequests": 30,
  "maxRunSeconds": 60,
  "groupBy": "publication-month",
  "onlyNew": true,
  "previousRunId": "REPLACEWITHBASELINERUNID"
}
```

Replace the example run ID with your own baseline from this Actor. It must have status `SUCCEEDED` and `OUTPUT.ready=true`, with its checkpoint and storage still available. An initial incremental run can omit `previousRunId`. History is explicit: the Actor does not automatically look up your most recent run or import another user's history. Full article IDs remain in the cumulative history, but old full articles are not revisited for edits.

For continuation, copy the interrupted or limited run's original input, remove `previousRunId` if present, and add `resumeFromRunId` with that run's ID. Keep sources, date filters, `groupBy` and `onlyNew` unchanged. The referenced run must be terminal (`SUCCEEDED`, `FAILED`, `ABORTED` or `TIMED-OUT`) and have a usable checkpoint and saved records. A running or failed-before-checkpoint run cannot serve as a continuation baseline.

**Interrupted-export recovery:** Use the default `maxPackBytes: 200000` for the recommended workflow. Very small packs combined with a low charge limit can leave insufficient resources to recover after export has already started; recovery may stop with `history_budget_exceeded` and `OUTPUT.ready=false`. Existing Dataset rows remain accessible, but they do not mean the ZIP bundle was completed. Fees for full articles already delivered to the Dataset are not reversed, and carried articles are not charged again. Larger packs reduce export writes but do not guarantee recovery.

Do not combine the two history IDs. Per-invocation article, request, page and collection-time allowances renew on continuation; output capacity still includes saved records. A resumed bundle can therefore contain more rows than the new run's `maxArticles`. Increase `maxOutputMb` when needed. Continuation processes saved pending articles and re-enumerates unfinished sources, deduplicating saved article IDs. This also supports checkpoints from the previous offset-based archive API. Current archive responses use cursor pagination with an explicit end marker. Invalid responses and repeated pages or cursors leave coverage incomplete.

Continuation is also subject to a resource preflight. Before copying saved articles, the Actor checks checkpoint size, actual article bytes and the planned Markdown files against the current run's output allowance and a conservative copy/export budget. A large archive or very small `maxPackBytes` can be rejected with `history_output_limit` or `history_budget_exceeded`, with `OUTPUT.ready=false`. The original run remains available. Increasing `maxPackBytes` reduces split files; more allocated memory increases the startup price and available recovery budget. These changes do not guarantee that any archive size will be accepted. `previousRunId` avoids copying old bodies, but it does not finish pending work from an incomplete run.

Incremental collection does not copy unfinished work from the baseline. Continue an incomplete archive first if you need that selected range finished before starting a new-only cycle. Checking known IDs, duplicate sources, filtered dates and failed requests still consumes checkpoint and request resources. A run can therefore stop with partial coverage and `cost_guard` even when no new article fee is charged.

#### Why FULL permissions are required

Cross-run history checks the previous run's owner, Actor, terminal status and selection before reading its checkpoint. That run-metadata check requires Apify `FULL_PERMISSIONS` in this implementation. Full permissions grant broad access to your Apify account; they are not limited to this one archive. The implementation uses them to read the explicitly referenced, validated run and its storage, then writes to the current run's storage.

Approve the Actor's requested permissions in Apify Console before using it through the API. A full-permission Actor also needs this approval for a fresh run, even though fresh collection itself does not read cross-run history. See [Apify's permission documentation](https://docs.apify.com/actors/development/permissions).

The history must belong to the same Apify user and the same Actor. Having full permissions does not enable cross-account history import. Do not put an Apify account token in INPUT or custom Actor environment variables. If history permission checks fail, `OUTPUT.ready` is `false` and `OUTPUT.error.code` is `history_permissions_required`.

### Use the API

Save one of the complete input examples as `input.json`. These shell examples require `curl` and `jq`, and an `APIFY_TOKEN` supplied securely in your environment. The launch target is `tubetext/substack-research-archive`.

Start the run asynchronously using [Apify's Run Actor API](https://docs.apify.com/api/v2/actors-runs-post):

```sh
curl --fail --silent --show-error --request POST \
  'https://api.apify.com/v2/actors/tubetext~substack-research-archive/runs?timeout=180&memory=512' \
  --header "Authorization: Bearer $APIFY_TOKEN" \
  --header 'Content-Type: application/json' \
  --data-binary @input.json --output run.json

SUBSTACK_RUN_ID=$(jq -r '.data.id' run.json)
```

The 180-second timeout leaves export time after the examples' 60-second collection budget. Choose a longer Apify timeout if you raise `maxRunSeconds`. Keep the returned run ID; do not start another run just to check progress.

Read the run status with [Get Actor run](https://docs.apify.com/api/v2/actor-run-get), which can wait up to 60 seconds for completion:

```sh
curl --fail --silent --show-error \
  "https://api.apify.com/v2/actor-runs/$SUBSTACK_RUN_ID?waitForFinish=60" \
  --header "Authorization: Bearer $APIFY_TOKEN" --output status.json

jq '.data | {id, status, defaultDatasetId, defaultKeyValueStoreId}' status.json
```

If the status is still transitional, repeat the status GET later. After the run ends, inspect its output manifest:

```sh
SUBSTACK_STORE_ID=$(jq -r '.data.defaultKeyValueStoreId' status.json)

curl --fail --silent --show-error \
  "https://api.apify.com/v2/key-value-stores/$SUBSTACK_STORE_ID/records/OUTPUT" \
  --header "Authorization: Bearer $APIFY_TOKEN" --output output.json

jq '{ready, complete, articles, contentCounts, stopReason, error, files}' output.json
```

Only use the current export when `ready` is `true`. Check `complete` and coverage to decide whether it meets your requested scope. If `OUTPUT` is missing or not ready, inspect the run error instead of assuming any older stored files form a finished bundle.

Download the ZIP and consolidated JSON through the [key-value store record API](https://docs.apify.com/api/v2/key-value-store-record-get):

```sh
curl --fail --silent --show-error \
  "https://api.apify.com/v2/key-value-stores/$SUBSTACK_STORE_ID/records/BUNDLE.zip" \
  --header "Authorization: Bearer $APIFY_TOKEN" --output research.zip

curl --fail --silent --show-error \
  "https://api.apify.com/v2/key-value-stores/$SUBSTACK_STORE_ID/records/ARTICLES" \
  --header "Authorization: Bearer $APIFY_TOKEN" --output articles.json
```

Use the same record endpoint for `INDEX.csv`, `COVERAGE` and the Markdown keys in `OUTPUT.files.markdown`. The run's default Dataset is also available for integrations; the ZIP and `ARTICLES` preserve the consolidated article projection.

### Pricing

You pay for newly delivered **full articles** and the Actor's startup event. Platform usage is included in these event prices. No AI or proxy service is used.

| Apify tier | Per full article | Per 1,000 full articles |
| --- | ---: | ---: |
| FREE | $0.0040 | $4.00 |
| BRONZE | $0.0038 | $3.80 |
| SILVER | $0.0034 | $3.40 |
| GOLD, PLATINUM, DIAMOND | $0.0030 | $3.00 |

**Actor Start: $0.005 per allocated GB, rounded up, with a minimum of one event.** The default 512 MB run therefore has a $0.005 startup charge; a 2 GB run has a $0.010 startup charge. Apify charges this automatically when a run starts, including runs with invalid inputs, source failures or no new full articles.

The `full-article` event applies after a new full article's body, Markdown and source links have been saved and made accessible in the Dataset. A later interruption or export failure does not undo an already-delivered article's charge. Check `OUTPUT.ready` before treating the ZIP/CSV/Markdown package as finished; use the saved article rows or continue from the checkpoint if final exports are incomplete.

There is **no article result fee** for previews, unknown-access or empty rows, failed fetches, duplicate input results, full IDs skipped by incremental collection, or records copied through `resumeFromRunId`. A rechecked preview that remains a preview is free of article fees; if it now delivers full text, the full-article event applies. A fresh collection that omits history starts a new archive and can charge again for full articles collected earlier in a different run. Each new run still has its startup charge.

#### Cost examples

These examples use the FREE tier and default 512 MB memory. They describe event charges, not a promise that a source will return a particular number of full articles.

| Workload | Calculation | Total |
| --- | --- | ---: |
| 20 new full articles plus 5 previews | $0.005 startup + 20 × $0.004 | $0.085 |
| Incremental run with no new full articles | $0.005 startup + no article events | $0.005 |
| Resume 20 saved articles and deliver 10 new full articles | $0.005 startup + 10 × $0.004; saved articles are not billed again | $0.045 |
| Invalid input, failed sources or previews only | Startup applies; no full-article events | $0.005 |

Set Apify's **Maximum cost per run** separately from the resource fields. The minimum configured maximum is $0.005; at 512 MB this covers startup only and leaves no budget for a full article. Use at least $0.009 on FREE or $0.0088 on BRONZE to allow startup plus one full article. Higher memory requires a correspondingly larger maximum.

Collection stops when the remaining charge allowance cannot cover another full article, even if later sources might yield free previews. The remaining budget includes startup and already billed articles. A `charge_limit` stop leaves partial coverage; it does not mean the rest of the sources were processed.

The Actor can also stop early with `cost_guard` based on conservative collection, storage and export reservations, or `platform_timeout_margin` to leave time for charge confirmation and exports. Export resources are checked before saving each new article, including free previews. Same-run recovery consumes additional reservations for replay and export; repeated recovery can be refused. If a guard stops finalization, `OUTPUT.ready` stays false, while previously delivered Dataset articles remain accessible and chargeable. These guards and input limits do not guarantee a precise platform-cost estimate or a complete archive. Check coverage before continuing; a continuation is a new run with its own startup charge.

If a charge response is lost, the Actor stops and retains a billing intent. Same-run recovery checks recorded event counts before retrying. An old intent that remains unconfirmed outside the safe retry window is not automatically charged again; contact support with the run ID.

### Common errors and limits

| Symptom | What to check |
| --- | --- |
| `Unknown input field` or invalid source/date | Use only supported fields, public HTTPS URLs and valid UTC dates. Publication URLs must be a homepage or `/archive`; direct articles must use `/p/slug`. |
| `history_permissions_required` | Approve FULL permissions in Console and confirm the referenced run and storage remain accessible. Start a new run after correcting permissions. |
| Previous-run ownership or terminal-state error | Use your own terminal run of this same Actor. An incremental baseline must be `SUCCEEDED`; a run from another Actor is rejected. |
| Checkpoint or previous-run configuration mismatch | Restore the same sources, dates and grouping. For continuation, preserve `onlyNew` too; start a fresh archive when changing the selection. |
| `charge_limit`, `cost_guard`, `platform_timeout_margin`, `article_limit`, `publication_limit`, `page_limit`, `request_limit`, `time_limit`, `download_limit` or `output_limit` | Review `COVERAGE`, then continue with the original selection and suitable limits if saved state is available. |
| `history_output_limit` or `history_budget_exceeded` | Keep the original run. Check `maxOutputMb`, reduce Markdown splitting with a larger `maxPackBytes`, or use a smaller archive. More memory increases startup pricing; old articles are never billed again to fund recovery. |
| `archive_error`, HTTP error or non-JSON response | Check the failed source URL in `COVERAGE`; it may be unavailable, blocked or not a compatible Substack publication. Partial delivery does not mean that source succeeded. |
| `repeated_page` | The source repeated an archive page. Coverage remains incomplete; retry later without treating the previous result as a complete archive. |
| `history_limit` | One checkpoint supports up to 10,000 collected records and 100,000 remembered full article IDs. Start a new archive/history; it will not automatically inherit deduplication across that boundary. |
| Article metadata exceeds `maxPackBytes` | Increase the Markdown file-size limit. |
| No usable output after a timeout or abort | Check for a valid saved checkpoint before continuing. Export finalization needs time after collection. |

A single response is limited to 5 MB in both compressed and decompressed form. The Actor does not use proxies. It validates public addresses and redirects; networks that substitute private or fake IPs can be rejected. No input option disables those checks.

This release does not collect comments or Notes, browse user profiles, discover publications globally, or crawl section/tag pages as inputs. It does not log in to Substack, unlock subscriber-only full text, transcribe audio/video, OCR images, generate AI summaries, or automatically upload files into NotebookLM. You can use the exported source files in compatible tools yourself.

For help, [open an issue](https://apify.com/tubetext/substack-research-archive/issues) with the run ID, input fields and relevant coverage error. Keep credentials out of the report. [More TubeText tools](https://apify.com/tubetext).

# Actor input Schema

## `publications` (type: `array`):

Homepage URLs, custom domains, or Substack handles. Provide this and/or postUrls. Maximum 100 sources in total.

## `postUrls` (type: `array`):

Public article links such as https://name.substack.com/p/article. Supports custom publication domains.

## `publishedAfter` (type: `string`):

Optional YYYY-MM-DD or UTC ISO timestamp. Inclusive lower bound.

## `publishedBefore` (type: `string`):

YYYY-MM-DD includes that full UTC day; a UTC ISO timestamp is exclusive. No implicit date cutoff stops archive enumeration.

## `maxArticles` (type: `integer`):

Maximum new records added per invocation, including previews. Resume renews this allowance; previously saved records remain in the resumed bundle.

## `maxArticlesPerPublication` (type: `integer`):

Per-invocation limit for each input publication host.

## `maxRequests` (type: `integer`):

Includes archive pages, post requests, redirects and retries.

## `maxArchivePages` (type: `integer`):

Limits enumeration, including filtered and previously seen pages. Short pages do not stop the crawl.

## `maxRunSeconds` (type: `integer`):

Stops collection after this elapsed time. Requests also stop 60 seconds before the platform timeout to reserve confirmation and export time. External delays can still prevent export completion.

## `maxDownloadMb` (type: `integer`):

Compressed HTTP response bodies. Headers, TLS and platform storage traffic are not included.

## `maxOutputMb` (type: `integer`):

Maximum combined serialized article records, including previously resumed records. CSV, Markdown, ZIP and checkpoints use additional storage.

## `maxPackBytes` (type: `integer`):

Maximum UTF-8 bytes per Markdown file. Long articles repeat source metadata in every part. Very small values create more files and may reach the export resource budget.

## `groupBy` (type: `string`):

Each file retains the individual article sources.

## `onlyNew` (type: `boolean`):

With previousRunId, skip IDs previously delivered as full text. Without a previous run, establish the initial history. Previews are rechecked. Does not detect changes to old full articles.

## `previousRunId` (type: `string`):

Requires onlyNew. Must be a successful run of this Actor by the same user, using the same sources, dates and grouping. Its stored output must still exist.

## `resumeFromRunId` (type: `string`):

Copies saved articles and unfinished work from a terminal run of this Actor by the same user, subject to output and copy/export resource checks. Old records have no article fee; startup still applies. Keep sources, dates, grouping and onlyNew unchanged. Do not combine with previousRunId.

## Actor input object example

```json
{
  "publications": [
    "https://simonw.substack.com"
  ],
  "maxArticles": 100,
  "maxArticlesPerPublication": 100,
  "maxRequests": 500,
  "maxArchivePages": 100,
  "maxRunSeconds": 300,
  "maxDownloadMb": 50,
  "maxOutputMb": 50,
  "maxPackBytes": 200000,
  "groupBy": "publication-month",
  "onlyNew": false
}
```

# Actor output Schema

## `articles` (type: `string`):

No description

## `bundle` (type: `string`):

No description

## `index` (type: `string`):

No description

## `coverage` (type: `string`):

No description

## `manifest` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "publications": [
        "https://simonw.substack.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tubetext/substack-research-archive").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "publications": ["https://simonw.substack.com"] }

# Run the Actor and wait for it to finish
run = client.actor("tubetext/substack-research-archive").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "publications": [
    "https://simonw.substack.com"
  ]
}' |
apify call tubetext/substack-research-archive --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tubetext/substack-research-archive"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cnnCs7rmjei1abVRM/builds/Nfd1Skf2SXUojUhFR/openapi.json
