How to Schedule Social Media Posts via API
Building a post scheduling system from scratch is a rabbit hole. You need a queue, a cron job (or several), timezone handling, retry logic for when platforms are down, and you have to do all of that for each platform separately.
Or you can add two fields to your PostPeer API call and we handle the rest.
This is how scheduling works with PostPeer, start to finish.
The short version
You already know how to post with PostPeer (POST /v1/posts with publishNow: true). To schedule instead, just swap publishNow for scheduledFor and timezone:
POST https://api.postpeer.dev/v1/posts
You pass the date/time you want the post to go out and the timezone it's in. PostPeer converts it to UTC, queues it, and publishes it at exactly the right time. If a platform is temporarily down, we retry automatically.
Schedule a post
Here's a tweet and a Facebook post scheduled for Monday morning EST:
curl -X POST https://api.postpeer.dev/v1/posts \
-H "x-access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Good morning! Here is your Monday motivation.",
"platforms": [
{ "platform": "twitter", "accountId": "acc_tw_123" },
{ "platform": "facebook", "accountId": "acc_fb_456" }
],
"scheduledFor": "2026-04-07T08:00:00",
"timezone": "America/New_York"
}'Response:
{
"success": true,
"status": "scheduled",
"postId": "post_xyz789",
"scheduledFor": "2026-04-07T12:00:00.000Z",
"platforms": [
{ "platform": "twitter", "success": true },
{ "platform": "facebook", "success": true }
]
}scheduledFor is the UTC time it'll actually go out. That's it. The post is queued.
Schedule with video
Same thing, just add mediaItems. This schedules a product launch video to TikTok, Instagram, and YouTube all at once:
curl -X POST https://api.postpeer.dev/v1/posts \
-H "x-access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "New product drop this Friday!",
"mediaItems": [
{ "url": "https://cdn.example.com/product-launch.mp4", "type": "video" }
],
"platforms": [
{ "platform": "tiktok", "accountId": "acc_tt_123" },
{ "platform": "instagram", "accountId": "acc_ig_456" },
{
"platform": "youtube",
"accountId": "acc_yt_789",
"platformSpecificData": {
"title": "New Product Drop",
"visibility": "public"
}
}
],
"scheduledFor": "2026-04-11T14:00:00",
"timezone": "UTC"
}'YouTube scheduled videos get uploaded as private first, then flipped to your chosen visibility when the scheduled time hits.
Build out a whole content calendar
If you want to batch-schedule a week of posts, just loop through them:
const posts = [
{
content: "Monday tip: Start your week with planning.",
scheduledFor: "2026-04-07T09:00:00",
},
{
content: "Wednesday insight: Data-driven decisions matter.",
scheduledFor: "2026-04-09T09:00:00",
},
{
content: "Friday wrap-up: What we shipped this week.",
scheduledFor: "2026-04-11T16:00:00",
},
];
for (const post of posts) {
const response = await fetch("https://api.postpeer.dev/v1/posts", {
method: "POST",
headers: {
"x-access-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
content: post.content,
platforms: [
{ platform: "twitter", accountId: "acc_tw_123" },
],
scheduledFor: post.scheduledFor,
timezone: "America/New_York",
}),
});
const result = await response.json();
console.log(`Scheduled: ${result.postId} for ${result.scheduledFor}`);
}Three posts, three different times, all queued in a few seconds.
Managing scheduled posts
Plans change. Here's how to deal with that.
See what's scheduled:
curl https://api.postpeer.dev/v1/posts/scheduled \
-H "x-access-key: YOUR_API_KEY"Cancel a post:
curl -X DELETE https://api.postpeer.dev/v1/posts/scheduled/post_xyz789 \
-H "x-access-key: YOUR_API_KEY"Move it to a different time:
curl -X PATCH https://api.postpeer.dev/v1/posts/scheduled/post_xyz789 \
-H "x-access-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"scheduledFor": "2026-04-08T10:00:00",
"timezone": "Asia/Jerusalem"
}'A few things worth knowing
Timezones: Pass any IANA timezone string. America/New_York, Asia/Tokyo, Europe/London, whatever. If you don't pass one, we treat scheduledFor as UTC.
Don't schedule too close to now. Give it at least 5 minutes. Anything closer than that might just publish immediately instead of being queued.
Validation happens at schedule time, not publish time. If your tweet is too long or your image is the wrong format, you'll know right away when you make the API call. You won't find out 3 days later when the post was supposed to go out.
Try scheduling without code
If you want to see how scheduling feels before integrating, we have free browser tools:
- Twitter/X Post Scheduler - schedule tweets from your browser
- YouTube Video Scheduler - schedule video uploads from your browser
No code, no API key. Just connect your account, pick a time, and go.
More stuff
Our cross-posting guide covers posting to multiple platforms in one request. The full API reference is at postpeer.dev/docs. And signing up takes about 30 seconds - you get 20 free credits to play with.
If you're migrating from Ayrshare or another tool, we have side-by-side comparisons too.