Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.63 KB

File metadata and controls

47 lines (34 loc) · 1.63 KB

Substack API

npm version Documentation Status License: MIT TypeScript

A modern, type-safe TypeScript client for the Substack API. Build newsletter automation, content management tools, and subscriber analytics with ease.

QuickStart

pnpm add substack-api
import { SubstackClient } from 'substack-api';

// Initialize client with your token
const client = new SubstackClient({
  token: 'your-connect-sid-cookie-value',
  publicationUrl: 'example.substack.com'
});

// Get your profile and iterate through posts
const profile = await client.ownProfile();
for await (const post of profile.posts({ limit: 5 })) {
  console.log(`📄 "${post.title}" - ${post.publishedAt?.toLocaleDateString()}`);
}

// Test connectivity
const isConnected = await client.testConnectivity();

Documentation

📚 Complete Documentation →

License

MIT