Skip to content

File format for AI agents and developers

On this page

Every file MediaStash saves carries a JSON record describing its post, and bulk downloads add an _index.jsonl file with one record per line. The record follows the versioned schema mediastash.instagram/1, published as a JSON Schema. Nothing is uploaded: the extension has no AI inside and writes the data only into files on your computer. This page explains where the record lives in each file type, what every field means, and how to read it with common tools.

Quick facts

Schema idmediastash.instagram/1 (the schema field of every record)
JSON Schema/schema/mediastash.instagram-1.json
Written bymediastash/1.0.0 (the tool field: mediastash/<extension version>)
EncodingUTF-8 JSON. Numbers are plain numbers; unknown values are null, never missing
Videos and audiothe record is the comment tag
PhotosJPEG comment (COM) segment and XMP; WebP XMP chunk
Bulk downloads_index.jsonl: one record per post plus the names of its files

Where the record lives in each file

File typeWhere the JSON record isOther tags written
MP4 video (.mp4, H.264 + AAC)MP4 metadata (ilst), ©cmt — shown as comment by ffprobe and exiftool©nam title, ©ART artist (@username), ©day date, desc caption
M4A audiosame as MP4: the comment tagtitle, artist, date, description
MP3 audioID3v2 COMM frame (comment)TIT2 title, TPE1 artist, TDRC date
JPEG photo or covera COM (comment) segment with the JSON, and an XMP packet whose dc:description holds the same JSON— the image data is untouched
WebP photoan XMP chunk whose dc:description holds the JSON— the image data is untouched
_index.jsonlone JSON record per line—

Photos keep their original pixels: the record is added as extra segments or chunks, so the image is byte-for-byte the one Instagram served. Videos are always MP4 with H.264 video and AAC audio; when Instagram’s best version uses another codec, it is converted on your computer.

File and folder names

Files are saved in Chrome’s Downloads folder:

Downloads/Instagram/<account>/<account>_<YYYY-MM-DD>_<code>[_<n>][_audio|_cover|_music].<ext>
Downloads/Instagram/<account>/stories/…
Downloads/Instagram/<account>/highlights/<highlight title>/…
Downloads/Instagram/<account>/_index_<mode>_<YYYY-MM-DD-HH-MM>.jsonl
Downloads/Instagram/audio/<artist - title>_<audio id>.<mp3|m4a>
  • <YYYY-MM-DD> is the day the post was published (UTC); <code> is the post’s short code from its URL.
  • _<n> numbers the slides of a carousel (_1, _2 …).
  • _audio is a reel’s sound saved on its own, _cover a video’s cover image, _music the song attached to a photo post.
  • With “Save as one ZIP file” the same names are used inside the ZIP, and the index is called _index.jsonl.

The _index.jsonl file

The record inside each file is part of every download, free. Bulk downloads and their _index.jsonl dataset are part of MediaStash Pro.

Bulk downloads (“Download all” and its options) write an index next to the media: plain text, one JSON object per line (JSON Lines), one line per post, in the order the posts were saved. Each line is the post’s record plus a files array with the names of the files saved for it (relative to the folder or ZIP). The per-file item object is not included in index lines.

{"schema":"mediastash.instagram/1","platform":"instagram","url":"https://www.instagram.com/reel/DgEnau0FxTI/","shortcode":"DgEnau0FxTI","media_id":"3512345678901234567","type":"reel","author":{"username":"kai.films","full_name":"Kai Films","verified":false},"posted_at":"2026-11-24T08:12:00.000Z","caption":"First light over Fitz Roy #patagonia #hiking","hashtags":["#patagonia","#hiking"],"mentions":[],"location":{"name":"El Chaltén","city":null,"lat":null,"lng":null},"music":{"title":"Original audio","artist":"kai.films","original_audio":true},"collaborators":[],"tagged_users":[],"paid_partnership":false,"caption_edited":false,"stats":{"views":48210,"likes":3120,"comments":86,"shares":41,"reposts":null,"saves":null},"stats_hidden_by_creator":false,"stats_note":"Snapshot at captured_at. saves are not public on Instagram (always null).","captured_at":"2026-11-27T09:14:05.120Z","tool":"mediastash/1.0.0","files":["kai.films_2026-11-24_DgEnau0FxTI.mp4"]}

Every field of the record

The fields below are always present in post records; unknown values are null (or an empty list). Profile pictures and audio-page downloads use a shorter record (see record variants).

FieldTypeMeaning
schemastringAlways mediastash.instagram/1. A new major version gets a new id.
platformstringinstagram.
typestringreel, carousel, post (single photo or video), video (long-form video), story; also profile_picture and audio.
urlstring | nullLink to the post (/p/<code>/ or /reel/<code>/), story, profile or audio page.
shortcodestring | nullThe code in the post’s URL. null for stories.
media_idstring | nullInstagram’s numeric media id, as a string.
author.usernamestring | nullAccount that posted it, without @.
author.full_namestring | nullDisplay name.
author.verifiedboolean | nullVerified badge at the time of download.
posted_atstring | nullPublication time, ISO 8601 in UTC.
captionstring | nullFull caption text, including hashtags and emoji.
hashtagsstring[]Unique hashtags from the caption, with #.
mentionsstring[]Unique @mentions from the caption, with @.
locationobject | nullname, city, lat, lng (each may be null).
musicobject | nulltitle, artist, original_audio (true for the creator’s own sound).
collaboratorsstring[]Usernames of collab-post co-authors.
tagged_usersstring[]Usernames tagged in the photos or video.
paid_partnershipboolean | nullMarked as a paid partnership.
caption_editedboolean | nullThe caption was edited after posting.
stats.viewsnumber | nullPublic view or play count.
stats.likesnumber | nullLike count (null when hidden).
stats.commentsnumber | nullComment count.
stats.sharesnumber | nullShare count, when Instagram shows it.
stats.repostsnumber | nullRepost count, when Instagram shows it.
stats.savesnullNot public on Instagram; always null.
stats_hidden_by_creatorboolean | nullThe creator hid like and view counts.
stats_notestringReminder that counts are a snapshot taken at captured_at.
captured_atstringWhen the file was saved (ISO 8601, UTC). Counts are as of this moment.
toolstringmediastash/<version> of the extension that wrote it.
itemobjectIn files only. Which part of the post this file is: index and count (slide 2 of 5), kind (image, video, audio, cover), width, height (pixels) and duration (seconds), each null when unknown.
audioobjectAudio files of songs and audio pages only. id, title, artist, original_audio, duration_ms.
source_poststring | nullAudio-page downloads only. A reel that uses the sound.
filesstring[]In _index.jsonl only. Names of the files saved for this post.

Counts are a snapshot. If you download the same post again later, the new file has newer numbers and a newer captured_at. Compare posts captured at about the same time, or normalise by age (for example likes per day since posted_at).

Record variants

  • Profile picture (type: "profile_picture"): schema, platform, type, url, author (with an extra id), posted_at: null, caption: null, item, captured_at, tool.
  • Audio page (type: "audio"): schema, platform, type, url, audio, author (the artist), posted_at: null, caption: null, item, source_post, captured_at, tool.

Readers should ignore fields they don’t know: new optional fields can be added within version 1. Anything that would break a reader gets a new schema id.

Read the record with command-line tools

exiftool reads every format:

exiftool -s3 -Comment kai.films_2026-11-24_DgEnau0FxTI.mp4 | jq .
exiftool -s3 -Comment kai.films_2026-11-23_DgGMRgQApGi_1.jpg | jq .stats
exiftool -s3 -XMP-dc:Description kai.films_2026-11-23_DgGMRgQApGi_1.webp | jq .caption

ffprobe (part of FFmpeg) reads videos and audio:

ffprobe -v quiet -show_entries format_tags=comment -of default=nw=1:nk=1 kai.films_2026-11-24_DgEnau0FxTI.mp4 | jq .

jq works directly on the index:

# Top 10 posts by views
jq -s 'sort_by(-(.stats.views // 0)) | .[:10] | .[] | {url, views: .stats.views, caption}' _index_*.jsonl

# Export a spreadsheet
jq -r '[.posted_at, .type, .stats.views, .stats.likes, .stats.comments, .url] | @csv' _index_*.jsonl > posts.csv

# Most used hashtags
jq -r '.hashtags[]' _index_*.jsonl | sort | uniq -c | sort -rn | head

Read the record with Python

Standard library only, plus ffprobe for videos and Pillow for photos:

import html, json, re, subprocess, sys
from pathlib import Path

def from_xmp(xmp: bytes) -> dict:
    match = re.search(rb'<rdf:li xml:lang="x-default">(.*?)</rdf:li>', xmp, re.S)
    return json.loads(html.unescape(match.group(1).decode("utf-8")))

def read_record(path: Path) -> dict | None:
    suffix = path.suffix.lower()
    if suffix in (".mp4", ".m4a", ".mp3"):
        out = subprocess.run(
            ["ffprobe", "-v", "quiet", "-show_entries", "format_tags=comment",
             "-of", "default=nw=1:nk=1", str(path)],
            capture_output=True, text=True, check=True).stdout.strip()
        return json.loads(out) if out else None
    if suffix in (".jpg", ".jpeg", ".webp"):
        from PIL import Image  # pip install pillow
        with Image.open(path) as img:
            if "comment" in img.info:  # JPEG COM segment
                return json.loads(img.info["comment"])
            xmp = img.info.get("xmp")  # WebP XMP chunk
            return from_xmp(xmp) if xmp else None
    return None

for file in sorted(Path(sys.argv[1]).rglob("*")):
    record = read_record(file) if file.is_file() else None
    if record:
        print(file.name, record["type"], record["stats"]["views"] if "stats" in record else "")

To load an index: [json.loads(line) for line in open("_index_posts_2026-11-27-09-14.jsonl", encoding="utf-8")].

How an AI agent can analyse a folder of downloads

  1. Start with the index. If the folder has _index_*.jsonl (or _index.jsonl in a ZIP), read it first: one line per post, with all counts and the file names. No need to open the media.
  2. Otherwise read the files. For each .mp4, .m4a and .mp3, read the comment tag; for .jpg, the COM segment; for .webp, the XMP dc:description. Group files by url (or shortcode): carousel slides and covers share the same post record and differ only in item.
  3. Check the schema. Accept records whose schema is mediastash.instagram/1; validate against the JSON Schema if you need certainty.
  4. Treat counts as snapshots. Use captured_at and posted_at to compare fairly — for example views per day since posting. null means unknown or hidden, not zero.
  5. Use the text fields. caption, hashtags, mentions, music and location answer “what is this about?”; type separates reels from photos and stories.
  6. Cite the source. Every record has the post’s url, so answers can link back to Instagram.

Example questions an agent can answer from the index alone: which reels got the most views, which hashtags appear in the top posts, how engagement changed month by month, which songs a creator uses most.

Privacy

MediaStash writes these records on your computer, from information Instagram already shows you in your browser. It has no AI inside, no servers and no analytics, and it uploads nothing. Whether a file is ever read by an AI tool is entirely your choice. See the privacy policy.