Skip to main content

Media

Upload Media​

Upload media files to WhatsApp (Meta) for use in messages and templates. Returns a media_id valid for 30 days.

POST /api/v1/public/media/upload

info

Content-Type: This endpoint uses multipart/form-data, not JSON. The returned media_id can be used in send message or template payloads. Media expires after 30 days on Meta servers.

Supported File Types​

TypeFormatsMax Size
ImageJPEG, PNG, WebP5 MB
VideoMP4, 3GP16 MB
AudioOGG, MP3, AMR16 MB
DocumentPDF, DOC, DOCX16 MB

Example Request​

curl -X POST "https://chat.api.co.id/api/v1/public/media/upload" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/image.jpg"

Response​

{
"success": true,
"data": {
"media_id": "1234567890",
"type": "image",
"mime_type": "image/jpeg",
"file_name": "image.jpg",
"file_size": 245000,
"whatsapp_phone_number_id": "clyyy9876543210",
"expires_in": "30 days"
}
}

Usage: Send Uploaded Media​

After uploading, use the media_id as media_url in your send message request:

{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "image",
"media_url": "1234567890",
"caption": "Check this out!"
}

Try it out​

tip

Press Try it and paste your API key (kc_live_...) into the API key (Bearer) field. Get the key from API Keys. Requests run against your live account, so endpoints that send, create, or delete act on real data.

  • POST/api/v1/public/media/uploadUpload Media
Was this page helpful?