Skip to main content
The media resource handles the lifecycle of every file you send or receive. Uploaded media gets a mediaId you reference from messages.send; inbound media arrives as a mediaId you resolve to a signed URL.

Upload

file accepts a Buffer or Uint8Array — stream the file yourself if it doesn’t fit in memory.
Returns an . Save the mediaId only long enough to use it — WhatsApp expires uploaded media after ~30 days.

Get URL

Resolve an inbound mediaId to a signed, time-limited URL plus metadata:
The URL is signed by Meta and requires your access token in the Authorization header when you fetch it.

Delete

Removes the uploaded file from Meta’s storage. Safe to skip if you’re happy to let the 30-day expiration handle cleanup — delete explicitly when you need the space freed immediately (e.g. compliance requirements).

Supported MIME types

WhatsApp restricts which types are accepted per content category. The SDK passes whatever you give it — validation happens server-side. Check the official limits table for current size caps — they change per account tier.