| Endpoint | Uses |
|---|---|
Upload media. | |
Retrieve the URL for a specific media. | |
Delete a specific media. | |
Download media from a media URL. |
POST call to /PHONE_NUMBER_ID/media and include the parameters listed below. All media files sent through this endpoint are encrypted and persist for 30 days, unless they are deleted earlier.| Endpoint | Authentication |
|---|---|
/PHONE_NUMBER_ID/media(See Get Phone Number ID) | Developers can authenticate their API calls with the access token generated in the App Dashboard > WhatsApp > API Setup. Solution Partners must authenticate themselves with an access token with the whatsapp_business_messaging permission. |
| Name | Description |
|---|---|
file | Required. Path to the file stored in your local directory. For example: “@/local/path/file.jpg”. |
type | Required. Type of media file being uploaded. See Supported Media Types for more information. |
messaging_product | Required. Messaging service used for the request. In this case, use whatsapp. |
curl 'https://graph.facebook.com/<API_VERSION>/<PHONE_NUMBER_ID>/media' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -F 'messaging_product=whatsapp' \ -F 'file=@<FILE_PATH_AND_NAME>;type=<MIME_TYPE>'
{ "id": "<MEDIA_ID>" }
curl 'https://graph.facebook.com/v25.0/106540352242922/media' \
-H 'Authorization: Bearer EAAJB...' \
-F 'messaging_product=whatsapp' \
-F 'file=@/media/template_assets/black_friday_2025.mp4;type=video/mp4'
{ "id": "1037543291543636" }
url property.curl 'https://graph.facebook.com/<API_VERSION>/<MEDIA_ID>?phone_number_id=<BUSINESS_PHONE_NUMBER_ID>' \ -H 'Authorization: Bearer EAAJB'
phone_number_id is optional. If included, the request will only be processed if the business phone number ID included in the query matches the ID of the business phone number that the media was uploaded on.{ "messaging_product": "whatsapp", "url": "<MEDIA_URL>", "mime_type": "<MEDIA_MIME_TYPE>", "sha256": "<SHA_256_HASH>", "file_size": "<MEDIA_FILE_SIZE>", "id": "<MEDIA_ID>" }
curl -X DELETE 'https://graph.facebook.com/<API_VERSION>/<MEDIA_ID>?phone_number_id=<BUSINESS_PHONE_NUMBER_ID>' \ -H 'Authorization: Bearer EAAJB...'
phone_number_id is optional. If included, the request will only be processed if the business phone number ID included in the query matches the ID of the business phone number that the media was uploaded on.{ "success": true }
GET request on the media URL and include your access token. If you omit your token, the request will fail.curl '<MEDIA_URL>' \ -H 'Authorization: Bearer EAAJB...' \ -o '<DESIRED_FILE_NAME>'
404 Not Found response code. In that case, try to get a new media URL and download it again. If doing so doesn’t resolve the issue, renew your access token and attempt to download the media asset again.| Audio Type | Extension | MIME Type | Max Size |
|---|---|---|---|
AAC | .aac | audio/aac | 16 MB |
AMR | .amr | audio/amr | 16 MB |
MP3 | .mp3 | audio/mpeg | 16 MB |
MP4 Audio | .m4a | audio/mp4 | 16 MB |
OGG Audio | .ogg | audio/ogg (OPUS codecs only; base audio/ogg not supported; mono input only) | 16 MB |
| Document Type | Extension | MIME Type | Max Size |
|---|---|---|---|
Text | .txt | text/plain | 100 MB |
Microsoft Excel | .xls | application/vnd.ms-excel | 100 MB |
Microsoft Excel | .xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | 100 MB |
Microsoft Word | .doc | application/msword | 100 MB |
Microsoft Word | .docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | 100 MB |
Microsoft PowerPoint | .ppt | application/vnd.ms-powerpoint | 100 MB |
Microsoft PowerPoint | .pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | 100 MB |
PDF | .pdf | application/pdf | 100 MB |
| Image Type | Extension | MIME Type | Max Size |
|---|---|---|---|
JPEG | .jpeg | image/jpeg | 5 MB |
PNG | .png | image/png | 5 MB |
| Sticker Type | Extension | MIME Type | Max Size |
|---|---|---|---|
Animated sticker | .webp | image/webp | 500 KB |
Static sticker | .webp | image/webp | 100 KB |
| Video Type | Extension | MIME Type | Max Size |
|---|---|---|---|
3GPP | .3gp | video/3gpp | 16 MB |
MP4 Video | .mp4 | video/mp4 | 16 MB |
131053) is a common error. Inspect your media files to verify their MIME type. Make sure that your file name extensions reflect their types. For example, if you are using UNIX, you can inspect a file via the command line to determine its MIME type:file -I your-image-asset.pngtitle: