developer2026-03-29

Schedule Instagram Posts via API — Developer Guide

The Instagram Graph API lets you schedule posts programmatically. This guide covers authentication, the Content Publishing API endpoints, rate limits, and a working Node.js example.

Prerequisites

Before you can schedule via API, you need:

1. An Instagram Business or Creator account

2. A Facebook Page linked to the Instagram account

3. A Meta Developer App with Instagram permissions

4. An access token with `instagram_basic`, `instagram_content_publish`, and `pages_show_list` permissions

If you do not want to build this yourself, SociaHive's API wraps all of this with a simpler interface and handles token management for you.

The Content Publishing API

Instagram uses a two-step process to publish content:

Step 1: Create a media container

```

POST https://graph.facebook.com/v19.0/{ig-user-id}/media

```

Parameters:

  • `image_url` or `video_url` — publicly accessible URL of the media
  • `caption` — your post caption
  • `publish` — set to `false` for scheduling
  • `scheduled_publish_time` — Unix timestamp (10 minutes to 75 days from now)

Step 2: Publish the container

For scheduled posts, skip this step. The container publishes automatically at the scheduled time.

For immediate publish:

```

POST https://graph.facebook.com/v19.0/{ig-user-id}/media_publish

```

Parameters:

  • `creation_id` — the container ID from step 1

Scheduling a Post (Node.js Example)

```javascript

const GRAPH_API = 'https://graph.facebook.com/v19.0';

async function schedulePost(userId, accessToken, imageUrl, caption, publishTime) {

// Step 1: Create container with scheduled time

const containerRes = await fetch(`${GRAPH_API}/${userId}/media`, {

method: 'POST',

headers: { 'Content-Type': 'application/json' },

body: JSON.stringify({

image_url: imageUrl,

caption: caption,

scheduled_publish_time: Math.floor(publishTime.getTime() / 1000),

access_token: accessToken,

}),

});

const container = await containerRes.json();

console.log('Scheduled container:', container.id);

return container.id;

}

```

Scheduling a Carousel

Carousels require creating child containers first, then a parent container:

1. Create individual containers for each image/video (up to 10)

2. Create a parent carousel container with `children` parameter listing the child IDs

3. Set `scheduled_publish_time` on the parent container

Rate Limits

Instagram enforces these limits per account:

  • 50 API-published posts per 24 hours (includes scheduled and immediate)
  • Scheduling window: 10 minutes to 75 days in the future
  • Container creation: 50 per hour per account
  • General API rate: 200 calls per user per hour

Exceeding these limits returns error code 4 (rate limit) or 32 (page request limit).

Error Handling

Common errors when scheduling:

| Error Code | Meaning | Fix |

|------------|---------|-----|

| 9 | Permission denied | Check app permissions and access token |

| 36003 | Media URL not accessible | Ensure image/video URL is publicly accessible |

| 2207026 | Scheduled time invalid | Must be 10min to 75 days from now |

| 190 | Access token expired | Refresh the token |

Using SociaHive API Instead

If you do not want to manage Meta API authentication, token refresh, and error handling yourself, SociaHive's MCP server and API provides a simpler interface:

  • Handles OAuth and token refresh automatically
  • Supports all 9 platforms from one API
  • Visual flow builder for non-developers
  • Built-in retry logic and error recovery

Frequently Asked Questions

Is the Instagram Content Publishing API free?

Yes. Meta does not charge for API access. Your costs come from hosting your application and the scheduling tool you use.

Can I schedule Reels through the API?

Yes. Use `media_type: 'REELS'` and `video_url` instead of `image_url`. Licensed music from Instagram's library is not available through the API.

How do I get an Instagram API access token?

Create a Meta Developer App, add Instagram permissions, and authenticate through the OAuth flow. The process takes 30-60 minutes for initial setup.

Ready to automate your Instagram?

Plans start at $49/mo with a 30-day money-back guarantee.

Get Started