I am able to post a video from a public URL as a REEL:
import requests
token = "..."
api_version="v23.0"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
# Get my user ID
id_url = f"https://graph.instagram.com/{api_version}/me"
id_response = requests.get(id_url, headers=headers)
user_id = id_response.json()['id']
# Upload a video on a public URL as a REEL
url = f"https://graph.instagram.com/{api_version}/{user_id}/media"
video_url = "https://download.samplelib.com/mp4/sample-5s.mp4"
payload = {
"video_url": video_path,
"media_type": "REELS",
}
response = requests.post(
url=url,
headers=headers,
data=payload
)
post_id = json.loads(out.content)['id']
# wait until video has been uploaded ...
publish_url = f"https://graph.instagram.com/{api_version}/{user_id}/media_publish"
payload = {
"creation_id": post_id
}
response = requests.post(publish_url, headers=headers, data=payload)
reel_id = response.json()['id'])
However, I cannot upload a local file. I've tried following the documentation but without any luck. I currenty have an App with Instagram Login.
Ajeet Verma
4,5567 gold badges20 silver badges31 bronze badges
asked Aug 15, 2025 at 16:25
Physics_Student
7383 silver badges15 bronze badges
-
1If this approach CANNOT work with local videos, what is a good strategy to temporarily (and for free, ideally) store short videos on a public address, so that I can upload them to instagram as REELS?Physics_Student– Physics_Student2025年08月15日 16:36:13 +00:00Commented Aug 15, 2025 at 16:36
-
You should add your comment in question.furas– furas2025年08月15日 18:16:06 +00:00Commented Aug 15, 2025 at 18:16
-
python - How to upload image saved in local device to Instagram Graph API - Stack Overflowfuras– furas2025年08月15日 18:19:35 +00:00Commented Aug 15, 2025 at 18:19
-
b3nab/instapy-cli: :sparkles: Python library and CLI to upload photo and video on Instagram. W/o a phone!furas– furas2025年08月15日 18:20:59 +00:00Commented Aug 15, 2025 at 18:20
lang-py