Warning
This library is no longer actively developed. The current generation of this project is Substack Gateway OSS — a Python REST API and MCP server that replaces this TypeScript client. If you are building new integrations, start there.
A modern, type-safe TypeScript client for the Substack API. Build newsletter automation, content management tools, and subscriber analytics with ease.
pnpm add substack-apiimport { SubstackClient } from 'substack-api';
const client = new SubstackClient({
token: 'your-connect-sid-cookie-value',
publicationUrl: 'example.substack.com'
});
const profile = await client.ownProfile();
for await (const post of profile.posts({ limit: 5 })) {
console.log(`"${post.title}" - ${post.publishedAt?.toLocaleDateString()}`);
}
const isConnected = await client.testConnectivity();This library served as the foundation for a broader ecosystem. The current generation is Substack Gateway OSS — a language-agnostic REST API and MCP server that exposes the same capabilities to any client, including Claude, n8n, and custom agents.
Built by Jakub Slys — Backend Engineer building distributed systems for telecoms, running a self-hosted Kubernetes homelab, and building AI automation pipelines with n8n, MCP, and Claude.
This library was the first step toward automating my own Substack at iam.slys.dev, where I write about system design, machine learning fundamentals, and the AI tools I actually build and run in production.
MIT