{
  "openapi": "3.0.1",
  "info": {
    "title": "Substack Newsletter Finder: Best Newsletters on Any Topic",
    "description": "Type a topic, get the most credible Substack newsletters on it, ranked 0-100 by subscribers, engagement, comment depth, consistency and topic fit, with why each ranks, its best on-topic post, and whether it takes sponsors. Also export posts, rank and monitor known newsletters.",
    "version": "0.3",
    "x-build-id": "vnaAaOhag7djMf9ew"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgelabs~substack-newsletter-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgelabs-substack-newsletter-intelligence",
        "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/forgelabs~substack-newsletter-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-forgelabs-substack-newsletter-intelligence",
        "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/forgelabs~substack-newsletter-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-forgelabs-substack-newsletter-intelligence",
        "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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "discoverByTopic",
              "posts",
              "rankNewsletters",
              "newSinceLastRun"
            ],
            "type": "string",
            "description": "Discover by topic = type a topic, get the most credible Substack newsletters on it, ranked with a transparent score and their best posts. Other modes work on newsletters you already know.",
            "default": "discoverByTopic"
          },
          "topic": {
            "title": "Topic",
            "type": "string",
            "description": "What do you want to read about? e.g. \"AI startup idea validation\", \"B2B SaaS pricing\", \"climate tech investing\".",
            "default": "AI startup idea validation"
          },
          "maxNewsletters": {
            "title": "How many newsletters to return",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Top N ranked newsletters (Discover mode).",
            "default": 10
          },
          "extraSearchQueries": {
            "title": "Extra search phrases (optional)",
            "type": "array",
            "description": "More phrasings of your topic to widen the search, e.g. \"zero to one\", \"customer discovery\".",
            "items": {
              "type": "string"
            }
          },
          "searchDepth": {
            "title": "Search depth (pages per phrase)",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "More pages = more candidate newsletters, slower run.",
            "default": 4
          },
          "language": {
            "title": "Language filter (optional)",
            "type": "string",
            "description": "e.g. \"en\". Leave empty for any."
          },
          "onlySponsorReady": {
            "title": "Only newsletters that take sponsors",
            "type": "boolean",
            "description": "Keep only newsletters with an advertise/sponsor page or sponsor mentions in recent posts. Useful for sponsorship buyers and agencies.",
            "default": false
          },
          "publications": {
            "title": "Publications",
            "type": "array",
            "description": "Only for Posts / Rank / Monitor modes. Substack subdomains (e.g. 'astralcodexten'), *.substack.com URLs, or custom domains (e.g. 'www.lennysnewsletter.com').",
            "items": {
              "type": "string"
            }
          },
          "maxPostsPerPublication": {
            "title": "Max posts per publication",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Max posts per publication.",
            "default": 50
          },
          "publishedAfter": {
            "title": "Only posts published after (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional date filter."
          },
          "includeBodyText": {
            "title": "Include full text of free posts",
            "type": "boolean",
            "description": "Adds plain text of publicly readable posts (paywalled posts return only the public preview).",
            "default": false
          },
          "includePaidPosts": {
            "title": "Include paywalled posts (metadata only)",
            "type": "boolean",
            "description": "Include paywalled posts (metadata only).",
            "default": true
          },
          "rankBy": {
            "title": "Rank by (rankNewsletters mode)",
            "enum": [
              "avgEngagement",
              "medianEngagement",
              "topPostEngagement",
              "postsPerWeek",
              "followerCount",
              "subscriberCountPublic"
            ],
            "type": "string",
            "description": "Metric used to sort newsletters in rankNewsletters mode.",
            "default": "avgEngagement"
          },
          "includeProfiles": {
            "title": "Also save publication profiles",
            "type": "boolean",
            "description": "In posts/monitor modes, also save one profile per newsletter (subscriber count if public, posting frequency, engagement stats, author and public social links) to the PROFILES record of the default key-value store.",
            "default": false
          },
          "monitorStateName": {
            "title": "Monitor state name",
            "type": "string",
            "description": "Named key-value store that remembers the last seen post per newsletter. Use different names for independent monitors.",
            "default": "substack-monitor-state"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}