facebookfacebook-graph-apioauth-2.0instagrammedia

Meta /media_publish return 500 unknown error


I'm using the Instagram Graph API via https://graph.facebook.com/v21.0 to publish both images and videos on Instagram. Publishing images works without issues, but I'm encountering a problem when attempting to publish videos.

Here’s my process:

1. Create Media Container for Video

I create a media container using the following request:

POST https://graph.facebook.com/v21.0/<user-id>/media
{
   video_url: video.mp4 (744k, 18s long H264 MPEG-4 AAC)
   caption: caption
   media_type: REELS
   share_to_feed: true
   access_token: ...
}

2. Publish Media Using the Container ID Then, I attempt to publish the video with this request:

POST https://graph.facebook.com/v21.0/<user-id>/media
{
    creation_id: <id-container>
    access_token: ...
}

However, this returns a 500 error:

{
    "error": {
        "message": "An unknown error has occurred.",
        "type": "OAuthException",
        "code": 1,
        "fbtrace_id": <trace-id>
    }
}

I can't find anything on the community forum and the bug report is not working either. Any idea what I could try?


Solution

  • It turns out I was missing the publish_video permission in my access token.

    Once I included that permission, the video publishing process worked as expected.