npm.io
1.4.1 • Published yesterdayCLI

@posteverywhere/sdk

Licence
MIT
Version
1.4.1
Deps
0
Size
112 kB
Vulns
0
Weekly
0
Stars
1

PostEverywhere — Official Node.js SDK

npm version npm downloads License: MIT GitHub stars

The official Node.js / TypeScript SDK for PostEverywhere — schedule and publish posts to Instagram, TikTok, YouTube, LinkedIn, Facebook, X (Twitter), Threads, and Pinterest from a single API. Build social media scheduling, content automation, and AI agent workflows in minutes.

Building an AI agent? Try the companion @posteverywhere/mcp package — a Model Context Protocol server that lets Claude Code, Claude Desktop, Cursor, and other MCP-compatible clients schedule posts using natural language.

Resource URL
Homepage posteverywhere.ai
Developers landing page posteverywhere.ai/developers
API Documentation developers.posteverywhere.ai
This SDK on npm npmjs.com/package/@posteverywhere/sdk
This SDK on GitHub github.com/posteverywhere/sdk
MCP server (npm) npmjs.com/package/@posteverywhere/mcp
MCP server (GitHub) github.com/posteverywhere/mcp
Dashboard app.posteverywhere.ai
Get an API key app.posteverywhere.ai/developers
Pricing posteverywhere.ai/pricing
Help Center posteverywhere.ai/support
Issues / bug reports github.com/posteverywhere/sdk/issues
Support support@posteverywhere.ai

Why PostEverywhere SDK?

  • One API, eight platforms — write once, publish to Instagram, TikTok, YouTube, LinkedIn, Facebook, X, Threads, and Pinterest
  • Schedule posts at any future time with timezone awareness
  • AI image generation built in (Flux, Ideogram, Gemini 3, Nano Banana Pro)
  • Multi-platform publishing with per-platform content overrides
  • Robust error handling with typed exceptions, automatic retries, and rate-limit awareness
  • Full TypeScript support with rich type definitions
  • AI-agent friendly — clean REST envelope, retryable flags on every error, idempotency keys, circuit breaker
  • Transparent pricing — flat plans from $19/mo, 7-day free trial, cancel anytime

A modern, API-first alternative to legacy social media management tools — designed for developers, AI agents, and automation-heavy workflows.

Install

npm install @posteverywhere/sdk
pnpm add @posteverywhere/sdk
yarn add @posteverywhere/sdk

Quick Start

import PostEverywhere from '@posteverywhere/sdk';

const client = new PostEverywhere({
  apiKey: 'pe_live_your_api_key_here',
});

// List connected social accounts
const { accounts } = await client.accounts.list();
console.log(accounts);

// Publish to all accounts immediately
const post = await client.posts.create({
  content: 'Hello from the PostEverywhere SDK! 🚀',
  publish_now: true,
});

// Or schedule for later
const scheduled = await client.posts.create({
  content: 'Tomorrow morning',
  scheduled_for: '2026-04-30T09:00:00Z',
  timezone: 'America/New_York',
});

Getting Started

  1. Sign up free at posteverywhere.ai — 7-day free trial
  2. Connect your social accounts in the dashboard (Instagram, TikTok, YouTube, LinkedIn, Facebook, X, Threads, Pinterest)
  3. Create an API key under Settings → Developers
  4. Install the SDK (above) and start building
  5. Read the full API docs for every endpoint

Accounts

// List all connected social accounts across all platforms
const { accounts } = await client.accounts.list();

// Get a single account by ID
const account = await client.accounts.get(123);

Each account has a health field showing token status and whether it can post — useful for surfacing reconnect prompts to your users.

Posts

The core of the SDK. Create, schedule, edit, retry, and delete posts across all platforms.

// Publish immediately to ALL connected accounts
const post = await client.posts.create({
  content: 'My post content',
  publish_now: true,
});

// Schedule for later (timezone-aware)
const scheduled = await client.posts.create({
  content: 'Scheduled post',
  scheduled_for: '2026-03-20T09:00:00Z',
  timezone: 'America/New_York',
});

// Target specific accounts only
const targeted = await client.posts.create({
  content: 'Just for Instagram and TikTok',
  account_ids: [456, 789],
  publish_now: true,
});

// Attach media (upload first, then reference)
const withMedia = await client.posts.create({
  content: 'Check out this photo!',
  media_ids: ['media-uuid-here'],
  publish_now: true,
});

// Per-platform content overrides — same post, different copy per network
const customized = await client.posts.create({
  content: 'Default content',
  platform_content: {
    twitter: { content: 'Short version for X' },
    linkedin: { content: 'Longer professional version for LinkedIn...' },
  },
  publish_now: true,
});

// List posts with filters
const { posts } = await client.posts.list({ status: 'done', limit: 10 });

// Get per-platform publishing results (with platform_post_url for each)
const results = await client.posts.results('post-id');

// Retry failed destinations
await client.posts.retry('post-id');

// Update a scheduled or draft post
await client.posts.update('post-id', { content: 'Updated content' });

// Delete a post
await client.posts.delete('post-id');

Full posts API reference →

Bulk Scheduling

Scheduled posts (with a future scheduled_for) bypass the per-minute publishing limit, so you can fire a month of content in parallel:

const posts = [
  { content: 'Monday morning', scheduled_for: '2026-04-01T09:00:00Z' },
  { content: 'Wednesday update', scheduled_for: '2026-04-03T12:00:00Z' },
  { content: 'Friday wrap-up', scheduled_for: '2026-04-05T16:00:00Z' },
];

const results = await Promise.allSettled(
  posts.map(p =>
    client.posts.create({
      content: p.content,
      account_ids: [2280, 2282],
      scheduled_for: p.scheduled_for,
    })
  )
);

Media

Two paths depending on where your file lives:

One-call URL import (image-only, 25 MB cap) — new in v1.3.0

If your image is already at a public URL (web search result, OG image, hosted screenshot), this is the fastest path. Server fetches the bytes and returns a ready-to-attach media_id.

const media = await client.media.uploadFromUrl({
  url: 'https://example.com/hero.webp',
});

await client.posts.create({
  content: 'Photo post!',
  account_ids: [123],
  media_ids: [media.media_id],
});
Local files / videos / >25 MB images (3-step flow handled internally)

For local files or videos, client.media.upload(...) handles the full presign → PUT → complete dance internally.

import fs from 'fs';

const media = await client.media.upload(
  fs.readFileSync('photo.jpg'),
  { filename: 'photo.jpg', contentType: 'image/jpeg' }
);

await client.posts.create({
  content: 'Photo post!',
  media_ids: [media.id],
  publish_now: true,
});
Library management
// List your media library
const { media: files } = await client.media.list({ type: 'image' });

// Delete media
await client.media.delete('media-id');

Media requirements per platform →

AI Image Generation

Generate images from text prompts using state-of-the-art models, then post them directly.

const image = await client.ai.generateImage({
  prompt: 'A professional social media banner with abstract green shapes',
  model: 'flux-schnell',
  aspect_ratio: '16:9',
});

await client.posts.create({
  content: 'AI-generated visual!',
  media_ids: [image.media_id],
  publish_now: true,
});

Available models: nano-banana-pro, ideogram-v2, gemini-3-pro, flux-schnell

Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4, 4:5, 5:4

AI Agent Integration

The PostEverywhere API is designed to be agent-friendly:

  • retryable: false on every permanent error — agents know when to stop retrying
  • Circuit breaker on identical-content failures (after 5 retries, returns 422 with permanent_failure_circuit_breaker) so runaway loops can't burn rate limits
  • Stable error codes — programmatic error handling
  • Comprehensive validation with explicit per-platform validation_errors

Using a Claude/MCP-style agent? Skip this SDK and use @posteverywhere/mcp instead — natural-language scheduling via the Model Context Protocol. Works with Claude Code, Claude Desktop, Cursor, and other MCP-compatible clients.

LLM agent system prompt template →

Error Handling

import PostEverywhere, {
  AuthenticationError,
  RateLimitError,
  ValidationError,
  InsufficientCreditsError,
  PostEverywhereError,
} from '@posteverywhere/sdk';

try {
  await client.posts.create({ content: 'Hello!' });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key — check your key at posteverywhere.ai/developers');
  } else if (error instanceof RateLimitError) {
    console.error('Rate limited, retry after:', error.retryAfter, 'seconds');
  } else if (error instanceof ValidationError) {
    console.error('Bad request:', error.details);
  } else if (error instanceof InsufficientCreditsError) {
    console.error('Not enough AI credits — upgrade or wait for monthly reset');
  } else if (error instanceof PostEverywhereError) {
    console.error('API error:', error.message, error.requestId);
  }
}

Every error includes a retryable boolean — use it instead of inferring retry behavior from status codes.

Full error reference →

Configuration

const client = new PostEverywhere({
  apiKey: 'pe_live_...',  // Required
  timeout: 120000,        // Default: 120s (AI generation can be slow)
  maxRetries: 2,          // Default: 2 — automatic retry on 429/5xx with backoff
});

Rate Limits

Resource Per minute Per hour Per day
General API calls 60 1,000
Posts 60 200 1,000
AI generation 60

The SDK auto-retries on 429 with exponential backoff, respecting the Retry-After header. See Rate Limits for the full breakdown.

Supported Platforms

All eight platforms work on every plan — no per-network add-ons:

  • Instagram Scheduler — feed, reels, stories, carousels
  • TikTok Scheduler — videos, photo carousels
  • YouTube Scheduler — videos with thumbnails, tags, descriptions
  • LinkedIn Scheduler — text, images, video, documents (carousels)
  • Facebook Scheduler — pages, video, reels, multi-image
  • X (Twitter) Scheduler — text, threads, media, tier-aware char limits
  • Threads Scheduler — text and media posts
  • Pinterest Scheduler — pins to boards

Documentation

PostEverywhere Around the Web

Per-Platform Schedulers

Every plan includes every platform — these are the per-platform landing pages:

Support

License

MIT — see LICENSE.


Built by the team at PostEverywhere. The smarter way to schedule social media posts to Instagram, TikTok, YouTube, LinkedIn, Facebook, X, Threads, and Pinterest from one place.

Keywords