Skip to main content

SDKs & CLI

PostEverywhere provides a Node.js SDK, a CLI, and REST API access for any language. Pick the approach that fits your workflow.

Node.js SDK

Installation

npm install @posteverywhere/sdk

Initialization

import { PostEverywhere } from '@posteverywhere/sdk';

const client = new PostEverywhere({
apiKey: process.env.POSTEVERYWHERE_API_KEY, // pe_live_...
});
caution

Never hard-code your API key. Use environment variables or a secrets manager. See Authentication for details.

List Connected Accounts

const { accounts } = await client.accounts.list();

for (const account of accounts) {
console.log(`${account.platform} — @${account.username} (${account.status})`);
}

Create and Schedule a Post

const post = await client.posts.create({
content: 'Just shipped a major update! Check it out at example.com',
account_ids: [123, 456],
scheduled_for: '2026-04-07T14:00:00Z', // canonical — always UTC
});

console.log(`Post ${post.id} scheduled for ${post.scheduled_for}`);
Round-trip safe

The response from client.posts.create() has the same top-level field names as the request, so you can take any post and create a clone by passing its fields straight back in. scheduled_for, account_ids, media_ids, platform_content, timezone, content — all round-trip.

Platform-Specific Content

Customize content per platform using platform_content:

const post = await client.posts.create({
content: 'Default content for all platforms',
account_ids: [123, 456, 789],
platform_content: {
x: {
content: 'Short version for X (under 280 chars)',
},
linkedin: {
content: 'Longer, more detailed version for LinkedIn with professional tone...',
},
instagram: {
content: 'Visual-first caption with #hashtags',
},
},
scheduled_for: '2026-04-07T14:00:00Z',
});

Upload Media

import fs from 'fs';

// Start an upload
const upload = await client.media.upload({
fileName: 'product-launch.jpg',
contentType: 'image/jpeg',
});

// Upload the file to the pre-signed URL
await fetch(upload.uploadUrl, {
method: 'PUT',
body: fs.readFileSync('./product-launch.jpg'),
headers: { 'Content-Type': 'image/jpeg' },
});

// Complete the upload
const media = await client.media.complete(upload.mediaId);

// Use it in a post
await client.posts.create({
content: 'Our new product is here!',
account_ids: [123],
media_ids: [media.id],
});

Schedule a Week of Posts

Loop through your posts and call create() for each with a future scheduled_for:

const posts = [
{ content: 'Monday motivation: ship fast, learn faster', scheduled_for: '2026-04-07T09:00:00Z' },
{ content: 'Tuesday tip: automate your social media with APIs', scheduled_for: '2026-04-08T09:00:00Z' },
{ content: 'Wednesday win: our users scheduled 10,000 posts last week', scheduled_for: '2026-04-09T09:00:00Z' },
{ content: 'Thursday thought: the best content strategy is consistency', scheduled_for: '2026-04-10T09:00:00Z' },
{ content: 'Friday launch: new API endpoints are live!', scheduled_for: '2026-04-11T09:00:00Z' },
];

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

const created = results.filter((r) => r.status === 'fulfilled').length;
const failed = results.filter((r) => r.status === 'rejected').length;
console.log(`Scheduled ${created} posts, ${failed} failed`);

Check Post Results

const results = await client.posts.getResults('post_789');

// `destinations` is a rich per-platform array with account_id, account_name,
// status, platform_post_url, error (if failed), and published_at.
for (const dest of results.destinations) {
console.log(`${dest.platform} (@${dest.account_name}): ${dest.status}`);
if (dest.status === 'failed' && dest.error) {
console.log(` [${dest.error.code}] ${dest.error.message}`);
} else if (dest.status === 'published') {
console.log(` ${dest.platform_post_url}`);
}
}

CLI

The PostEverywhere CLI lets you manage posts and accounts from your terminal.

Authentication

# Set your API key
export POSTEVERYWHERE_API_KEY="pe_live_..."

# Or authenticate interactively
npx posteverywhere login

Common Commands

# List connected accounts
npx posteverywhere accounts

# Create a post (publishes immediately)
npx posteverywhere post "Just shipped v2.0!" --accounts acc_123,acc_456

# Schedule a post
npx posteverywhere schedule "Big announcement coming soon" \
--accounts acc_123,acc_456 \
--at "2026-04-07T14:00:00Z"

# Upload media
npx posteverywhere media upload ./banner.png

# List scheduled posts
npx posteverywhere posts --status scheduled

# Initialize a project config
npx posteverywhere init

CLI in CI/CD Pipelines

You can use the CLI in GitHub Actions or other CI pipelines to automate social media as part of your release process:

# .github/workflows/release.yml
- name: Announce release on social media
env:
POSTEVERYWHERE_API_KEY: ${{ secrets.POSTEVERYWHERE_API_KEY }}
run: |
npx posteverywhere post \
"v${{ github.event.release.tag_name }} is live! ${{ github.event.release.html_url }}" \
--accounts acc_x_123,acc_li_456

Python

A dedicated Python SDK is not yet available. In the meantime, you can call the REST API directly with requests:

import requests
import os

API_KEY = os.environ["POSTEVERYWHERE_API_KEY"]
BASE_URL = "https://app.posteverywhere.ai/api/v1"

headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}

# List accounts
accounts = requests.get(f"{BASE_URL}/accounts", headers=headers).json()
print(accounts["data"])

# Create a scheduled post
post = requests.post(
f"{BASE_URL}/posts",
headers=headers,
json={
"content": "Hello from Python!",
"account_ids": [123, 456],
"scheduled_for": "2026-04-07T14:00:00Z", # canonical — UTC
},
).json()
print(f"Post {post['data']['id']} scheduled for {post['data']['scheduled_for']}")

cURL

For quick one-off requests or shell scripts:

# List accounts
curl https://app.posteverywhere.ai/api/v1/accounts \
-H "Authorization: Bearer $POSTEVERYWHERE_API_KEY"

# Create a post
curl -X POST https://app.posteverywhere.ai/api/v1/posts \
-H "Authorization: Bearer $POSTEVERYWHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello from cURL!",
"account_ids": [123],
"scheduled_for": "2026-04-07T14:00:00Z"
}'

# Upload media — one-call from a public URL (preferred when source is online)
curl -X POST https://app.posteverywhere.ai/api/v1/media/upload-from-url \
-H "Authorization: Bearer $POSTEVERYWHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/hero.webp"}'

# Upload media — 3-step flow (for local files or videos)
# Step 1: Get presigned URL. Required fields: filename, content_type, size.
curl -X POST https://app.posteverywhere.ai/api/v1/media/upload \
-H "Authorization: Bearer $POSTEVERYWHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename": "photo.jpg", "content_type": "image/jpeg", "size": 2048576}'
# Step 2: PUT/POST the bytes to the returned upload_url
# Step 3: POST /api/v1/media/{media_id}/complete to finalise

Next Steps