{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Scraper (Posts, Publications, Comments)",
    "description": "Posts from any Substack newsletter, including custom domains: title, authors, date, paywall flag, reactions, comments, restacks and optional full text. Find newsletters by search or category. Bounded retries; failed publications are never charged.",
    "version": "0.1",
    "x-build-id": "B3v3bORY0fp1XGawj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/signalclear~substack-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-signalclear-substack-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/signalclear~substack-scraper/runs": {
      "post": {
        "operationId": "runs-sync-signalclear-substack-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/signalclear~substack-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-signalclear-substack-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "publications": {
            "title": "Publications",
            "type": "array",
            "description": "One newsletter per line: its Substack name (the part before .substack.com, e.g. example), a name.substack.com address, a custom-domain URL, or any post URL on it.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search for publications",
            "type": "array",
            "description": "Keywords to find newsletters with Substack's publication search. Each match is scraped like a publication you listed. The number of matches per query is capped by 'Publications per search or category'.",
            "items": {
              "type": "string"
            }
          },
          "categoryIds": {
            "title": "Category ids",
            "type": "array",
            "description": "Substack category ids whose top publications to scrape, e.g. 4 (Technology), 62 (Business), 153 (Finance), 134 (Science), 96 (Culture). Capped by 'Publications per search or category'.",
            "items": {
              "type": "string"
            }
          },
          "maxPublicationsPerQuery": {
            "title": "Publications per search or category",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "How many publications each search query or category adds to the run.",
            "default": 10
          },
          "maxPostsPerPublication": {
            "title": "Maximum posts per publication",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Stop after this many posts for each publication. Set 0 with 'Add a publication row' to collect publication info only.",
            "default": 50
          },
          "sort": {
            "title": "Sort posts by",
            "enum": [
              "new",
              "top"
            ],
            "type": "string",
            "description": "Newest first, or the publication's own 'Top' ranking (most engagement).",
            "default": "new"
          },
          "publishedSince": {
            "title": "Published since",
            "type": "string",
            "description": "Only posts published on or after this date (YYYY-MM-DD, UTC). With 'Newest' the run stops paging as soon as it passes the date; with 'Top' it scans at most 10x the post cap (at least 500 posts)."
          },
          "includeBody": {
            "title": "Fetch full post text",
            "type": "boolean",
            "description": "One extra request per post. Adds bodyHtml and bodyText. Paid-only posts return just the free preview Substack shows to logged-out readers; those rows have isPreviewOnly set.",
            "default": false
          },
          "includeComments": {
            "title": "Fetch comments",
            "type": "boolean",
            "description": "One extra request per post that has comments. Adds a row per comment (type: comment), replies included, up to 'Maximum comments per post'.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Maximum comments per post",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on comment rows per post, counting replies, in Substack's 'best first' order.",
            "default": 100
          },
          "includePublicationInfo": {
            "title": "Add a publication row",
            "type": "boolean",
            "description": "Adds one row per publication (type: publication) with its name, description, author, subscriber tier as Substack displays it, language and dates.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum rows in total",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on dataset rows (posts, comments and publication rows together) for the whole run. Leave empty for no cap."
          },
          "maxConcurrency": {
            "title": "Publications in parallel",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Publications fetched at the same time. Higher is faster but more likely to be rate-limited.",
            "default": 3
          },
          "maxAttempts": {
            "title": "Attempts per publication",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Each attempt uses a fresh proxy session and resumes where the last one stopped. Publications that still fail are listed in FAILED_PUBLICATIONS and are not charged. Unknown publications fail at once.",
            "default": 3
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "How long to wait for a single HTTP response before the attempt counts as failed and is retried on a fresh session.",
            "default": 30
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Substack's public JSON endpoints answer datacenter IPs, so the default Apify proxy is usually enough. Switch to residential if you see many retries.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}