SDKs & Libraries
The PostEverywhere API is a standard REST API that works with any HTTP client in any language. Copy-paste examples below to get started in seconds.
Overview
Every PostEverywhere endpoint accepts JSON request bodies and returns JSON responses. Authenticate with a Bearer token, set Content-Type: application/json, and you are ready to go. No SDK installation required.
All responses follow a consistent envelope: { data, meta: { request_id, timestamp } }. Error responses include a structured { error: { code, message, details } } object — the code field contains a machine-readable error identifier like invalid_request or rate_limit_exceeded. The request_id is useful for debugging — include it when contacting support.
Below you will find complete, working examples in cURL, Python, Node.js, and PHP. Each example demonstrates the same workflow: authenticate, list connected accounts, and create a scheduled post.
cURL
cURL is available on macOS, Linux, and Windows 10+. These commands work in any terminal.
1. List connected accounts
curl -s https://app.posteverywhere.ai/api/v1/accounts \
-H "Authorization: Bearer pe_live_your_key_here" | python3 -m json.tool2. Create a scheduled post
curl -X POST https://app.posteverywhere.ai/api/v1/posts \
-H "Authorization: Bearer pe_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"content": "Just shipped a new feature — check it out!",
"account_ids": [1, 2, 3],
"scheduled_at": "2026-03-15T14:00:00Z",
"timezone": "America/New_York"
}'3. Check publishing results
# Replace 42 with the post ID from the create response
curl -s https://app.posteverywhere.ai/api/v1/posts/42/results \
-H "Authorization: Bearer pe_live_your_key_here" | python3 -m json.toolPython
Uses the requests library. Install it first:
pip install requestsFull example: list accounts and schedule a post
import requests
import json
# ── Configuration ──────────────────────────────────────────
API_KEY = "pe_live_your_key_here"
BASE_URL = "https://app.posteverywhere.ai/api/v1"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
# ── Step 1: List connected accounts ───────────────────────
response = requests.get(f"{BASE_URL}/accounts", headers=HEADERS)
response.raise_for_status()
accounts = response.json()["data"]
for account in accounts:
print(f" {account['id']} {account['platform']:10} {account['name']}")
# Pick the first three accounts
account_ids = [a["id"] for a in accounts[:3]]
print(f"\nPosting to account IDs: {account_ids}")
# ── Step 2: Create a scheduled post ───────────────────────
post_body = {
"content": "Our Q1 product update is live — link in bio!",
"account_ids": account_ids,
"scheduled_at": "2026-03-15T14:00:00Z",
"timezone": "America/New_York",
}
response = requests.post(
f"{BASE_URL}/posts",
headers=HEADERS,
json=post_body,
)
response.raise_for_status()
post = response.json()["data"]
post_id = post["id"]
print(f"\nCreated post {post_id} — status: {post['status']}")
print(f"Request ID: {response.json()['meta']['request_id']}")
# ── Step 3: Check publishing results ──────────────────────
results_response = requests.get(
f"{BASE_URL}/posts/{post_id}/results",
headers=HEADERS,
)
results_response.raise_for_status()
results = results_response.json()["data"]
for result in results:
status = result["status"]
platform = result["platform"]
url = result.get("published_url", "—")
print(f" {platform:10} {status:10} {url}")Node.js
Uses the native fetch API available in Node.js 18+. No dependencies required.
Full example: list accounts and schedule a post
// posteverywhere.mjs — run with: node posteverywhere.mjs
const API_KEY = "pe_live_your_key_here";
const BASE_URL = "https://app.posteverywhere.ai/api/v1";
const headers = {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
};
async function main() {
// ── Step 1: List connected accounts ─────────────────────
const accountsRes = await fetch(`${BASE_URL}/accounts`, { headers });
if (!accountsRes.ok) throw new Error(`GET /accounts failed: ${accountsRes.status}`);
const { data: accounts } = await accountsRes.json();
for (const acct of accounts) {
console.log(` ${acct.id} ${acct.platform.padEnd(10)} ${acct.name}`);
}
// Pick the first three accounts
const accountIds = accounts.slice(0, 3).map((a) => a.id);
console.log(`\nPosting to account IDs: ${JSON.stringify(accountIds)}`);
// ── Step 2: Create a scheduled post ─────────────────────
const postRes = await fetch(`${BASE_URL}/posts`, {
method: "POST",
headers,
body: JSON.stringify({
content: "Our Q1 product update is live — link in bio!",
account_ids: accountIds,
scheduled_at: "2026-03-15T14:00:00Z",
timezone: "America/New_York",
}),
});
if (!postRes.ok) throw new Error(`POST /posts failed: ${postRes.status}`);
const { data: post, meta } = await postRes.json();
console.log(`\nCreated post ${post.id} — status: ${post.status}`);
console.log(`Request ID: ${meta.request_id}`);
// ── Step 3: Check publishing results ────────────────────
const resultsRes = await fetch(`${BASE_URL}/posts/${post.id}/results`, { headers });
if (!resultsRes.ok) throw new Error(`GET /posts/${post.id}/results failed: ${resultsRes.status}`);
const { data: results } = await resultsRes.json();
for (const r of results) {
console.log(` ${r.platform.padEnd(10)} ${r.status.padEnd(10)} ${r.published_url ?? "—"}`);
}
}
main().catch(console.error);PHP
Uses PHP's built-in curl extension. No external packages needed.
Full example: list accounts and schedule a post
<?php
// posteverywhere.php — run with: php posteverywhere.php
$apiKey = "pe_live_your_key_here";
$baseUrl = "https://app.posteverywhere.ai/api/v1";
function apiRequest(string $method, string $url, string $apiKey, ?array $body = null): array
{
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer {$apiKey}",
"Content-Type: application/json",
],
]);
if ($method === "POST") {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
}
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode >= 400) {
throw new RuntimeException("HTTP {$httpCode}: {$response}");
}
return json_decode($response, true);
}
// ── Step 1: List connected accounts ───────────────────────
$result = apiRequest("GET", "{$baseUrl}/accounts", $apiKey);
$accounts = $result["data"];
foreach ($accounts as $account) {
printf(" %-4d %-10s %s\n", $account["id"], $account["platform"], $account["name"]);
}
// Pick the first three accounts
$accountIds = array_slice(array_column($accounts, "id"), 0, 3);
echo "\nPosting to account IDs: " . json_encode($accountIds) . "\n";
// ── Step 2: Create a scheduled post ───────────────────────
$postResult = apiRequest("POST", "{$baseUrl}/posts", $apiKey, [
"content" => "Our Q1 product update is live — link in bio!",
"account_ids" => $accountIds,
"scheduled_at" => "2026-03-15T14:00:00Z",
"timezone" => "America/New_York",
]);
$post = $postResult["data"];
$postId = $post["id"];
echo "\nCreated post {$postId} — status: {$post['status']}\n";
echo "Request ID: {$postResult['meta']['request_id']}\n";
// ── Step 3: Check publishing results ──────────────────────
$resultsData = apiRequest("GET", "{$baseUrl}/posts/{$postId}/results", $apiKey);
$results = $resultsData["data"];
foreach ($results as $r) {
$url = $r["published_url"] ?? "—";
printf(" %-10s %-10s %s\n", $r["platform"], $r["status"], $url);
}AI image generation
Generate social media images from text prompts using POST /ai/generate-image. Requires the AI scope on your API key. Images are saved directly to your media library. See the AI Image Generation guide for all options.
cURL
curl -X POST https://app.posteverywhere.ai/api/v1/ai/generate-image \
-H "Authorization: Bearer pe_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A flat-lay photo of a laptop, coffee, and notebook on a marble desk",
"model": "ideogram-v3",
"aspect_ratio": "1:1"
}'Python
import requests
API_KEY = "pe_live_your_key_here"
BASE_URL = "https://app.posteverywhere.ai/api/v1"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
# Generate an AI image
response = requests.post(
f"{BASE_URL}/ai/generate-image",
headers=HEADERS,
json={
"prompt": "A flat-lay photo of a laptop, coffee, and notebook on a marble desk",
"model": "ideogram-v3",
"aspect_ratio": "1:1",
},
)
response.raise_for_status()
image = response.json()["data"]
print(f"Media ID: {image['media_id']}")
print(f"Image URL: {image['url']}")Complete workflow: upload media and post
This Node.js example demonstrates the full workflow: list accounts, upload an image via presigned URL, attach it to a scheduled post, then poll for results. See the Media API reference for supported file types and size limits.
// workflow.mjs — full media upload + post workflow
import { readFile } from "node:fs/promises";
const API_KEY = "pe_live_your_key_here";
const BASE_URL = "https://app.posteverywhere.ai/api/v1";
const headers = {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
};
async function main() {
// ── Step 1: List accounts ───────────────────────────────
const { data: accounts } = await (
await fetch(`${BASE_URL}/accounts`, { headers })
).json();
const accountIds = accounts.slice(0, 3).map((a) => a.id);
console.log(`Using accounts: ${JSON.stringify(accountIds)}`);
// ── Step 2: Request a presigned upload URL ──────────────
const uploadRes = await fetch(`${BASE_URL}/media/upload`, {
method: "POST",
headers,
body: JSON.stringify({
filename: "product-launch.png",
content_type: "image/png",
size: 524288, // 512 KB
}),
});
if (!uploadRes.ok) throw new Error(`POST /media/upload failed: ${uploadRes.status}`);
const { data: upload } = await uploadRes.json();
console.log(`Media ID: ${upload.media_id}`);
console.log(`Upload URL expires in ${upload.expires_in} seconds`);
// ── Step 3: Upload the file to the presigned URL ────────
const fileBuffer = await readFile("./product-launch.png");
const putRes = await fetch(upload.upload_url, {
method: "PUT",
headers: { "Content-Type": "image/png" },
body: fileBuffer,
});
if (!putRes.ok) throw new Error(`PUT upload failed: ${putRes.status}`);
console.log("File uploaded successfully");
// ── Step 4: Create a post with the uploaded media ───────
const postRes = await fetch(`${BASE_URL}/posts`, {
method: "POST",
headers,
body: JSON.stringify({
content: "Excited to announce our biggest update yet! Check it out.",
account_ids: accountIds,
media_ids: [upload.media_id],
scheduled_at: "2026-03-15T14:00:00Z",
timezone: "America/New_York",
}),
});
if (!postRes.ok) throw new Error(`POST /posts failed: ${postRes.status}`);
const { data: post } = await postRes.json();
console.log(`\nPost ${post.id} created — status: ${post.status}`);
// ── Step 5: Poll for publishing results ─────────────────
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
let attempts = 0;
while (attempts < 10) {
await sleep(3000);
attempts++;
const { data: results } = await (
await fetch(`${BASE_URL}/posts/${post.id}/results`, { headers })
).json();
const pending = results.filter((r) => r.status === "pending");
console.log(`Poll ${attempts}: ${results.length - pending.length}/${results.length} complete`);
if (pending.length === 0) {
console.log("\nAll platforms published:");
for (const r of results) {
console.log(` ${r.platform.padEnd(10)} ${r.status.padEnd(10)} ${r.published_url ?? "—"}`);
}
return;
}
}
console.log("Timed out waiting for results — check the dashboard.");
}
main().catch(console.error);Complete workflow: AI-generate an image and post
This Node.js example generates an image with AI, then immediately uses it in a scheduled post. The generated image is saved to your media library automatically — no upload step needed.
// ai-workflow.mjs — generate image with AI, then schedule a post
const API_KEY = "pe_live_your_key_here";
const BASE_URL = "https://app.posteverywhere.ai/api/v1";
const headers = {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
};
async function main() {
// ── Step 1: List accounts ───────────────────────────────
const { data: accounts } = await (
await fetch(`${BASE_URL}/accounts`, { headers })
).json();
const accountIds = accounts.slice(0, 3).map((a) => a.id);
console.log(`Using accounts: ${JSON.stringify(accountIds)}`);
// ── Step 2: Generate an image with AI ───────────────────
const aiRes = await fetch(`${BASE_URL}/ai/generate-image`, {
method: "POST",
headers,
body: JSON.stringify({
prompt: "A vibrant flat-lay of a product launch setup with confetti",
model: "ideogram-v3",
aspect_ratio: "16:9",
}),
});
if (!aiRes.ok) throw new Error(`AI generation failed: ${aiRes.status}`);
const { data: image } = await aiRes.json();
console.log(`Generated image: ${image.media_id}`);
// ── Step 3: Create a post with the AI-generated image ───
const postRes = await fetch(`${BASE_URL}/posts`, {
method: "POST",
headers,
body: JSON.stringify({
content: "Big announcement coming soon — stay tuned!",
account_ids: accountIds,
media_ids: [image.media_id],
scheduled_at: "2026-03-15T14:00:00Z",
timezone: "America/New_York",
}),
});
if (!postRes.ok) throw new Error(`POST /posts failed: ${postRes.status}`);
const { data: post } = await postRes.json();
console.log(`Post ${post.id} created with AI image — status: ${post.status}`);
}
main().catch(console.error);Auto-generate client libraries
PostEverywhere publishes an OpenAPI 3.0 specification that describes every endpoint, parameter, request body, and response schema. You can use this spec with openapi-generator to produce a fully typed client library in your preferred language.
Supported languages via openapi-generator
And 40+ more languages. See the openapi-generator documentation for the full list.
Example: generate a Go client
# Install openapi-generator (requires Java 11+)
npm install @openapitools/openapi-generator-cli -g
# Generate a Go client from the PostEverywhere OpenAPI spec
openapi-generator-cli generate \
-i posteverywhere-openapi.yaml \
-g go \
-o ./posteverywhere-go-client \
--additional-properties=packageName=posteverywhereExample: generate a Ruby client
openapi-generator-cli generate \
-i posteverywhere-openapi.yaml \
-g ruby \
-o ./posteverywhere-ruby-client \
--additional-properties=gemName=posteverywhereContact support@posteverywhere.ai to request the latest OpenAPI spec file, or download it from Settings > Developer in the PostEverywhere dashboard.
Community & support
Email support
For technical questions, integration help, or bug reports, email support@posteverywhere.ai. Include the request_id from your API response to help us trace issues quickly.
Documentation
Start with the Quick Start guide to make your first API call in under 5 minutes. Then explore the full API reference for endpoint details, request/response schemas, and error codes.
Authentication help
Having trouble with API keys or scopes? See the Authentication guide for step-by-step setup, or manage your keys in the dashboard.
Frequently asked questions
Does PostEverywhere have official SDKs?
Can I auto-generate a client library for my language?
Where can I get help with the API?
Related documentation
Start building with PostEverywhere
Get your API key, copy any example above, and go live in minutes.