Sends a media message (image, video, audio, or document) to a contact through a WABA channel. You can provide a public URL or a base64-encoded file.
Your API key for authentication.
Body
UUID of the WABA channel to send from.
UUID of the contact to message.
Type of media to send. Possible values: image, video, audio, document.
Either a publicly accessible URL (e.g. https://example.com/image.jpg) or a base64-encoded string of the file. If base64, the file is uploaded to storage automatically.
Optional caption for the media (text displayed below the file).
Original filename for document types (e.g. invoice.pdf). Defaults to a generated name based on media type.
UUID of an existing thread. If provided, channel_id and contact_id are inferred automatically.
save_message
boolean
predeterminado: "true"
Whether to save the message in the conversation thread. Defaults to true.
Response
true if the media was sent successfully.
Internal UUID of the message record.
WhatsApp message ID returned by Meta.
Public URL where the media file is stored.
UUID of the conversation thread.
Error Codes
400 Bad Request — Missing required fields, invalid channel type, or invalid media data
401 Unauthorized — Invalid or missing API key
404 Not Found — Contact not found
500 Internal Server Error — Upload or Meta API failure
Code Examples
cURL — Send image by URL
cURL — Send document by URL
JavaScript
Python
curl -X POST "https://api.contactship.ai/v1/waba/send-media" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "chn_abc123",
"contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
"media_type": "image",
"media_data": "https://example.com/product-catalog.jpg",
"content": "Check out our latest catalog!"
}'
{
"success" : true ,
"message" : "Media enviado y guardado" ,
"data" : {
"message_id" : "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890" ,
"provider_id" : "wamid.HBgNMTIxMjM0NTY3ODkwFQIAERgSM..." ,
"media_url" : "https://example.com/product-catalog.jpg" ,
"thread_id" : "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901"
}
}