You need to programmatically grab every image or video from a single Instagram post URL and get back direct download links you can save or proxy. By the end of this guide, you’ll call one endpoint that returns all media for a post with type, thumbnail, quality, and the final asset URLs you can stream to your users or store in your pipeline.
What this API does
The Instagram Media Downloader API extracts available media from Instagram posts, reels, and stories, returning direct download URLs, thumbnails, media types, and quality information when available. You pass an Instagram URL, and the API responds with a media array you can iterate over to download or display each asset.
This is useful for:
- Batch-saving all images from a carousel post.
- Prefetching thumbnails and HD originals for a media viewer.
- Building ingestion jobs or content moderation queues that rely on original asset URLs.
The endpoint you’ll use is Download All Content, and it’s purpose-built for the “give me everything from this one post URL” task.
Getting started on Zyla API Hub
Open the API on Zyla API Hub, subscribe, and get your key:
- Go to the Instagram Media Downloader API listing and click Subscribe (a 7-day trial is available on the item page): Start 7-day trial on Instagram Media Downloader API.
- Copy your API key from the dashboard and use it in the Authorization header as Bearer YOUR_API_KEY.
Zyla API Hub provides one account and one key for thousands of ready-to-use APIs, with subscription-and-quota billing rather than pay-per-call. Explore more categories and APIs anytime on Zyla API Hub.
Endpoint you’ll call
Download All Content
- Method: GET
- URL: https://zylalabs.com/api/2006/instagram-media-downloader-api/6285/download-all-content
- Description: Extracts available media from Instagram posts, reels, and stories, returning direct download URLs, thumbnails, media types, and quality when available.
Required parameter:
- url (string): Instagram URL of the post. Supported formats include Instagram post URLs. Example value: https://www.instagram.com/p/DZ3Qm4pEVfk
Notes that save time:
- URL-encode the url query parameter. The examples below show this encoding applied.
- The response returns an array under media. Always handle 0, 1, or many items (e.g., carousel posts).
- Use the thumbnail for previews and defer loading the full asset at url to improve perceived performance.
cURL you can paste
curl -s -X GET "https://zylalabs.com/api/2006/instagram-media-downloader-api/6285/download-all-content?url=https%3A%2F%2Fwww.instagram.com%2Fp%2FDZ3Qm4pEVfk" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
{"media":[{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728293829_18898565482045534_582397765186590945_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=YJaF3vgjg2MQ7kNvwFa1yjv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af9ntIi0Yg0LJDWgcuqUVqlaXgshJH78aWYz0sUCNbDSkQ&oe=6A433D78&_nc_sid=10d13b","url":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728293829_18898565482045534_582397765186590945_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=YJaF3vgjg2MQ7kNvwFa1yjv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af9ntIi0Yg0LJDWgcuqUVqlaXgshJH78aWYz0sUCNbDSkQ&oe=6A433D78&_nc_sid=10d13b"},{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728255088_18898565491045534_6095304335012657636_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=VOnxsOzPH-sQ7kNvwGtriHv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af_b9RC0HVc88i5VJqzpN5b8gZVQFMKu7ARzop192j7CCA&oe=6A433B0A&_nc_sid=10d13b","url":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728255088_18898565491045534_6095304335012657636_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=VOnxsOzPH-sQ7kNvwGtriHv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af_b9RC0HVc88i5VJqzpN5b8gZVQFMKu7ARzop192j7CCA&oe=6A433B0A&_nc_sid=10d13b"},{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728809708_18898565509045534_2471547694898437672_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat…
What to use from this payload:
- media: Array of media items for the post URL you sent.
- Each item has:
- type: The media type (e.g., image).
- quality: Quality label when available (e.g., HD).
- thumbnail: A preview-sized image, good for listing cards and preloads.
- url: The direct, full-resolution asset URL for download or streaming.
Python example using requests
This example calls the same endpoint and prints out the main fields you’ll use to render UI or download files. It uses the exact URL and parameters shown above.
import os
import requests
API_KEY = os.environ.get("ZYLALABS_API_KEY", "YOUR_API_KEY")
endpoint = "https://zylalabs.com/api/2006/instagram-media-downloader-api/6285/download-all-content"
params = {
"url": "https://www.instagram.com/p/DZ3Qm4pEVfk"
}
headers = {
"Authorization": f"Bearer {API_KEY}"
}
resp = requests.get(endpoint, params=params, headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
media = data.get("media", [])
print(f"Items: {len(media)}")
for i, item in enumerate(media, start=1):
mtype = item.get("type")
quality = item.get("quality")
thumb = item.get("thumbnail")
direct = item.get("url")
print(f"[{i}] type={mtype}, quality={quality}")
print(f" thumbnail={thumb}")
print(f" url={direct}")
# Example: download the first asset to disk (if present)
if media:
first = media[0]
asset_url = first.get("url")
if asset_url:
r = requests.get(asset_url, stream=True, timeout=60)
r.raise_for_status()
filename = f"ig_asset_1"
# Extension detection omitted intentionally; store as-is or derive from headers
with open(filename, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Saved first asset to {filename}")
Workflow tips and integration notes
- Encode the url parameter. If you build URLs manually, ensure https:// is preserved and special characters are encoded.
- Always iterate media as an array. Carousel posts can return several items; single-image posts return one.
- Use thumbnail for quick UI paint, lazy-load the full url for reduced time-to-first-interaction.
- Cache responsibly. If you’re proxying or re-serving assets, cache by the Instagram CDN URL and your own fetch timestamp to avoid redundant downloads.
- Verify accessibility. If a post is removed or becomes private, handle an empty media array gracefully and log the original Instagram URL for re-checks.
Common use cases
- Batch export: Given a list of post URLs, call the endpoint sequentially or in a controlled queue and persist each media item with type and source URL.
- Preview gallery: Render thumbnails immediately, and attach the full-resolution url to a “Download” button per item.
- Moderation pipeline: Ingest each item’s thumbnail for triage; if flagged, fetch the full asset from url for deeper analysis.
- Migration tool: For creators moving content, iterate media and mirror assets to your storage bucket.
MCP: call from an AI agent
If you’re wiring this into an AI coding agent or IDE extension, Zyla exposes all marketplace APIs through an MCP-compatible endpoint. Configure your client with your key and point it to the Zyla MCP service. See docs here: MCP. This allows tools like Claude Code, Cursor, and Windsurf to call the Instagram Media Downloader API using your existing Zyla API key and return the same media array you see above.
Error handling and reliability
- HTTP status: Treat non-2xx responses as failures; log and retry if appropriate.
- Empty arrays: An empty media array indicates no extractable assets for the given URL or that the media is not accessible. Guard for this in your code.
- Timeouts: Use reasonable client-side timeouts and backoff. If you queue multiple URLs, cap concurrency to avoid local resource contention.
- Thumbnails vs. full URLs: Prefer thumbnails for list views. The full url can be large; fetch only when needed.
Production checklist
- Store the original Instagram URL alongside your fetched results for traceability.
- Check your subscription quota on Zyla and build a basic request budget to prevent mid-batch failures.
- Implement retries with jitter on transient network errors.
- Persist minimal metadata: type, quality, thumbnail, url, and a fetched_at timestamp.
- Monitor for CDN changes. Since the response returns direct URLs, consider periodic revalidation if you cache for long periods.
Why use Zyla API Hub for this
Zyla API Hub centralizes more than 10,000 public APIs under one account, one API key, and a consistent subscription + quota model. You can add this Instagram media extraction to your stack now and expand to other data enrichment, AI, or utilities without juggling multiple vendors or auth methods. To begin, use the 7-day trial on the item page of the Instagram Media Downloader API and ship your integration this week.
FAQ
What URLs can I pass to the endpoint?
Provide a supported Instagram URL in the url parameter. The endpoint extracts media from posts, reels, and stories. The example in this guide shows an Instagram post URL format.
How do I authenticate?
Send your Zyla key as an HTTP header: Authorization: Bearer YOUR_API_KEY.
What does the response contain?
A media array where each item includes type, quality (when available), thumbnail, and the direct asset url.
How is billing handled?
Zyla uses subscription + quota, not pay-per-call. Check the API page for current access options and pricing, including the 7-day trial available on the item page.
Can I call this from an AI agent?
Yes. Use Zyla’s MCP service with your API key so MCP-compatible tools can invoke the same endpoint. See the MCP reference to configure your client.
Ready to build? Subscribe and get your key here: Start 7-day trial on Instagram Media Downloader API. Then drop the curl above into your terminal, wire up the Python sample, and ship your “download all content” feature today.
Official API response
{"media":[{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728293829_18898565482045534_582397765186590945_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=YJaF3vgjg2MQ7kNvwFa1yjv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af9ntIi0Yg0LJDWgcuqUVqlaXgshJH78aWYz0sUCNbDSkQ&oe=6A433D78&_nc_sid=10d13b","url":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728293829_18898565482045534_582397765186590945_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=YJaF3vgjg2MQ7kNvwFa1yjv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af9ntIi0Yg0LJDWgcuqUVqlaXgshJH78aWYz0sUCNbDSkQ&oe=6A433D78&_nc_sid=10d13b"},{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728255088_18898565491045534_6095304335012657636_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=VOnxsOzPH-sQ7kNvwGtriHv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af_b9RC0HVc88i5VJqzpN5b8gZVQFMKu7ARzop192j7CCA&oe=6A433B0A&_nc_sid=10d13b","url":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728255088_18898565491045534_6095304335012657636_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=VOnxsOzPH-sQ7kNvwGtriHv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af_b9RC0HVc88i5VJqzpN5b8gZVQFMKu7ARzop192j7CCA&oe=6A433B0A&_nc_sid=10d13b"},{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728809708_18898565509045534_2471547694898437672_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat…
Official API response
{"media":[{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728293829_18898565482045534_582397765186590945_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=YJaF3vgjg2MQ7kNvwFa1yjv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af9ntIi0Yg0LJDWgcuqUVqlaXgshJH78aWYz0sUCNbDSkQ&oe=6A433D78&_nc_sid=10d13b","url":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728293829_18898565482045534_582397765186590945_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=YJaF3vgjg2MQ7kNvwFa1yjv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af9ntIi0Yg0LJDWgcuqUVqlaXgshJH78aWYz0sUCNbDSkQ&oe=6A433D78&_nc_sid=10d13b"},{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728255088_18898565491045534_6095304335012657636_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=VOnxsOzPH-sQ7kNvwGtriHv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af_b9RC0HVc88i5VJqzpN5b8gZVQFMKu7ARzop192j7CCA&oe=6A433B0A&_nc_sid=10d13b","url":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728255088_18898565491045534_6095304335012657636_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat=1&_nc_oc=Q6cZ2gEdVaKbsdGJjr-CNk2lc4vZXJfdLRAzUScAcbfIz6JRME4u3vPi9-cVQTp_9K885VI&_nc_ohc=VOnxsOzPH-sQ7kNvwGtriHv&_nc_gid=ZznZ2dzdS79TA7cvya5fLw&edm=APs17CUBAAAA&ccb=7-5&oh=00_Af_b9RC0HVc88i5VJqzpN5b8gZVQFMKu7ARzop192j7CCA&oe=6A433B0A&_nc_sid=10d13b"},{"type":"image","quality":"HD","thumbnail":"https://scontent-arn2-1.cdninstagram.com/v/t51.82787-15/728809708_18898565509045534_2471547694898437672_n.jpg?stp=dst-jpg_e35_p1080x1080_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4yMzMzLnNkci5yZWd1bGFyX3Bob3RvLmMyIn0&_nc_ht=scontent-arn2-1.cdninstagram.com&_nc_cat…