Ensure the Instagram account is a Business or Creator account and is connected to a Facebook Page; personal accounts cannot use the Graph API.
Obtain a User access token with the instagram_basic, instagram_content_publish, and pages_read_engagement permissions via Facebook Login OAuth flow.
Create a media container by POSTing to https://graph.facebook.com/v19.0/{ig-user-id}/media with the image_url (publicly accessible) or video_url, plus caption and other fields; for video, also pass media_type=REELS or VIDEO.
Poll GET https://graph.facebook.com/v19.0/{container-id}?fields=status_code until the status_code is FINISHED (video processing can take minutes).
Publish the container by POSTing to https://graph.facebook.com/v19.0/{ig-user-id}/media_publish with creation_id set to the container ID.
Verify publication by GETting https://graph.facebook.com/v19.0/{ig-user-id}/media to confirm the post appears in the media list.
Known gotchas
The image or video URL must be publicly accessible over HTTPS at the time of container creation; URLs behind auth or on localhost will cause a silent failure or error.
Publishing is rate-limited to 50 API-published posts per 24-hour rolling window per Instagram account; hitting this returns error code 4 or a specific publishing limit error.
Access tokens expire; use a long-lived Page access token (60 days) or implement token refresh — short-lived tokens (1 hour) will break scheduled or background publishing jobs.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp