Sand AISand AI MAGI-2MAGI-2 現已登上 SandBase:支援原生音訊的 1080p 影片立即試用

Substack Posts

https://api.sandbase.ai/v1/api/substack/posts

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.

價格
自 $0.0444 起美元/次呼叫
方法
POST
回應
JSON
參數
1 個必填 · 11 個選填

Playground

輸入
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.com/p/your-book-review).
1100
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. 範圍:1 到 100。
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.
Return only free (non-paywalled) posts (e.g. true).
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.
Restrict to a single post type, or 'all' (e.g. newsletter).
0500
Maximum comments collected per post when 'includeComments' is true (0-500, default 20). Costs nothing extra (e.g. 50). 範圍:0 到 500。
Only return posts with at least this many comments (e.g. 10). 最小值:0。
Only return posts with at least this many reactions (e.g. 100). 最小值:0。
Only return posts with at least this many words, which filters out short notes and announcements (e.g. 1000). 最小值:0。
Include the full article body as text, HTML and Markdown. Set false for metadata only, which is faster (e.g. false).
Include public comment threads and their direct replies on each post (e.g. true).
輸出就緒

您的輸出會顯示在這裡

完成輸入後,點擊執行。

API README

Substack Posts API

Returns recent posts from a Substack publication, or one article when you pass a post URL. Each post includes title, subtitle, engagement counts, author and publication details, and the article body as text, HTML and Markdown. The only required input is url.

Use cases

  • Track engagement on each new post of a newsletter by comparing reactionCount, commentCount and restackCount.
  • Build a text archive of a publication by saving the markdown or text of each post.
  • Find long, free posts from a writer by filtering on wordcount and isPaid.
  • Collect reader discussion on a single article by setting includeComments to true.

Request

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

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
urlstringYesEither 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
contentTypestringNoRestrict to a single post type, or 'all' (e.g. newsletter).
endDatestringNoOnly 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.
includeCommentsbooleanNoInclude public comment threads and their direct replies on each post (e.g. true).
includeContentbooleanNoInclude the full article body as text, HTML and Markdown. Set false for metadata only, which is faster (e.g. false).
limitintegerNoMaximum 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.
maxCommentsintegerNoMaximum comments collected per post when 'includeComments' is true (0-500, default 20). Costs nothing extra (e.g. 50).
minCommentsintegerNoOnly return posts with at least this many comments (e.g. 10).
minReactionsintegerNoOnly return posts with at least this many reactions (e.g. 100).
minWordCountintegerNoOnly return posts with at least this many words, which filters out short notes and announcements (e.g. 1000).
onlyFreebooleanNoReturn only free (non-paywalled) posts (e.g. true).
startDatestringNoOnly 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.

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "data": {
    "items": [
      {
        "authorHandle": "astralcodexten",
        "authorImage": "https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/http…",
        "authorName": "Scott Alexander",
        "authorUrl": "https://substack.com/@astralcodexten",
        "commentCount": 244,
        "comments": [],
        "contentStatus": "full",
        "createdUtc": 1793595877,
        "description": "...",
        "hasVoiceover": true,
        "html": "<p>This is the weekly visible open thread. Post about anything you want, ask ran…",
        "image": "https://substack-post-media.s3.amazonaws.com/public/images/9d8ea239-2d80-4635-9f…"
      }
    ]
  },
  "found": true
}

Response fields

FieldMeaning
data.items[].title / subtitle / descriptionPost headline, subtitle and short summary. The summary or subtitle can be a literal ... when the author set none.
data.items[].url / slug / postIdPublic post URL, the URL slug, and the numeric post ID as a string.
data.items[].createdUtc / updatedUtcCreation and last update time as Unix timestamps in seconds.
data.items[].postTypeType of post, such as newsletter.
data.items[].isPaidtrue if the post is paywalled, false if it is free.
data.items[].wordcountNumber of words in the post.
data.items[].reactionCount / commentCount / replyCount / restackCountEngagement counts for the post: reactions, comments, replies and restacks.
data.items[].text / html / markdownArticle body in plain text, HTML and Markdown. These fields appear when includeContent is true, and can be missing on some items.
data.items[].authorName / authorHandle / authorUrlAuthor display name, Substack handle and profile URL.
data.items[].publication.name / subdomain / customDomainName of the publication, its Substack subdomain and its custom domain.

Notes

  • Pass a publication URL or custom domain to get recent posts. Pass a post URL ending in /p/slug to get one article.
  • Use limit (1-100) to set how many recent posts to return. The date filters apply only within the most recent limit posts, so raise limit to reach older posts.
  • comments is an empty list unless you set includeComments to true. maxComments sets the cap per post (0-500).
  • contentStatus shows full when the full body was returned. podcastUrl links to an audio file for the post.

Pricing

Billed at the actual cost of each call, about $0.0444 for the request above. Failed calls are not charged.

探索更多

相關 APIs

所有 APIs
API價格回應
Substack每次呼叫 $0.0444 起JSON

問題

常見問題

我要如何使用 Substack Posts API?

使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/substack/posts。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。

Substack Posts API 的費用是多少?

每次起 $0.0444,並從您的 SandBase 餘額中扣款。您只會為實際發出的呼叫付費;沒有訂閱方案。

Substack Posts API 接受哪些參數?

必要:url (string)。 選填:limit (integer), endDate (string), onlyFree (boolean), startDate (string), contentType(all, newsletter, podcast, thread 之一) 和 maxComments (integer),以及另外 5 個。 本頁的 Parameters 表格與 Playground 會列出每個欄位。

Substack Posts API 會回傳什麼?

在同一個 HTTP 請求中回傳的 JSON 回應(同步)。 本頁的 README 包含範例回應。

我需要 Substack 開發者帳號或 API 金鑰嗎?

不需要。Substack Posts 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 Substack API 存取權。