App Logo
instagram.com

Get Instagram DM attachment

Download the media attached to an Instagram DM message (photo, video, clip/reel share, voice note) by thread_id plus message id. Returns filename, mimeType, size and the bytes as base64, plus the direct media URL. Omit the message id to take the most recent media in the thread.

Input

threadId required

Instagram DM thread id (thread_id from instagram.com/get_inbox).

maxBytes optional

Refuse to base64-encode anything larger than this. Default 8000000 (8 MB) — videos can be far bigger, and the URL is still returned so it can be fetched directly.

messageId optional

Message/item id to download. Omit to take the most recent message in the thread that carries media.

Output

itemType required

Instagram's item_type, e.g. media, clip, voice_media, animated_media, media_share.

mediaUrl required
threadId required
messageId required
size optional

Byte size of the downloaded media.

base64 optional

Media bytes, base64-encoded. Null when the media exceeded maxBytes — mediaUrl is still usable.

filename optional
mimeType optional
pickedLatest optional

True when no messageId was given and the newest media item was used.

skippedEncoding optional

True when the bytes were not encoded because they exceeded maxBytes.

Start building not clicking